diff --git a/discovery/digitalocean/digitalocean.go b/discovery/digitalocean/digitalocean.go index 25436e2e4..a82466831 100644 --- a/discovery/digitalocean/digitalocean.go +++ b/discovery/digitalocean/digitalocean.go @@ -38,6 +38,7 @@ const ( doLabelID = doLabel + "droplet_id" doLabelName = doLabel + "droplet_name" doLabelImage = doLabel + "image" + doLabelImageName = doLabel + "image_name" doLabelPrivateIPv4 = doLabel + "private_ipv4" doLabelPublicIPv4 = doLabel + "public_ipv4" doLabelPublicIPv6 = doLabel + "public_ipv6" @@ -161,6 +162,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) { doLabelID: model.LabelValue(fmt.Sprintf("%d", droplet.ID)), doLabelName: model.LabelValue(droplet.Name), doLabelImage: model.LabelValue(droplet.Image.Slug), + doLabelImageName: model.LabelValue(droplet.Image.Name), doLabelPrivateIPv4: model.LabelValue(privateIPv4), doLabelPublicIPv4: model.LabelValue(publicIPv4), doLabelPublicIPv6: model.LabelValue(publicIPv6), diff --git a/discovery/digitalocean/digitalocean_test.go b/discovery/digitalocean/digitalocean_test.go index 9b8d1ba90..74d1d33a2 100644 --- a/discovery/digitalocean/digitalocean_test.go +++ b/discovery/digitalocean/digitalocean_test.go @@ -69,6 +69,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) { "__meta_digitalocean_droplet_id": model.LabelValue("3164444"), "__meta_digitalocean_droplet_name": model.LabelValue("example.com"), "__meta_digitalocean_image": model.LabelValue("ubuntu-16-04-x64"), + "__meta_digitalocean_image_name": model.LabelValue("14.04 x64"), "__meta_digitalocean_private_ipv4": model.LabelValue(""), "__meta_digitalocean_public_ipv4": model.LabelValue("104.236.32.182"), "__meta_digitalocean_public_ipv6": model.LabelValue("2604:A880:0800:0010:0000:0000:02DD:4001"), @@ -82,6 +83,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) { "__meta_digitalocean_droplet_id": model.LabelValue("3164494"), "__meta_digitalocean_droplet_name": model.LabelValue("prometheus"), "__meta_digitalocean_image": model.LabelValue("ubuntu-16-04-x64"), + "__meta_digitalocean_image_name": model.LabelValue("14.04 x64"), "__meta_digitalocean_private_ipv4": model.LabelValue(""), "__meta_digitalocean_public_ipv4": model.LabelValue("104.131.186.241"), "__meta_digitalocean_public_ipv6": model.LabelValue(""), @@ -96,6 +98,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) { "__meta_digitalocean_droplet_id": model.LabelValue("175072239"), "__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo-old"), "__meta_digitalocean_image": model.LabelValue("ubuntu-18-04-x64"), + "__meta_digitalocean_image_name": model.LabelValue("18.04.3 (LTS) x64"), "__meta_digitalocean_private_ipv4": model.LabelValue("10.135.64.211"), "__meta_digitalocean_public_ipv4": model.LabelValue("167.172.111.118"), "__meta_digitalocean_public_ipv6": model.LabelValue(""), @@ -109,6 +112,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) { "__meta_digitalocean_droplet_id": model.LabelValue("176011507"), "__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo"), "__meta_digitalocean_image": model.LabelValue("ubuntu-18-04-x64"), + "__meta_digitalocean_image_name": model.LabelValue("18.04.3 (LTS) x64"), "__meta_digitalocean_private_ipv4": model.LabelValue("10.135.64.212"), "__meta_digitalocean_public_ipv4": model.LabelValue("138.65.56.69"), "__meta_digitalocean_public_ipv6": model.LabelValue("2a03:b0c0:3:f0::cf2:4"), diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 306b00cec..6dd23b008 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -423,7 +423,8 @@ The following meta labels are available on targets during [relabeling](#relabel_ * `__meta_digitalocean_droplet_id`: the id of the droplet * `__meta_digitalocean_droplet_name`: the name of the droplet -* `__meta_digitalocean_image`: the image name of the droplet +* `__meta_digitalocean_image`: the slug of the droplet's image +* `__meta_digitalocean_image_name`: the display name of the droplet's image * `__meta_digitalocean_private_ipv4`: the private IPv4 of the droplet * `__meta_digitalocean_public_ipv4`: the public IPv4 of the droplet * `__meta_digitalocean_public_ipv6`: the public IPv6 of the droplet