mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #8497 from Amygos/master
Add image name meta label to DO service discovery
This commit is contained in:
commit
2ac80298e8
|
@ -38,6 +38,7 @@ const (
|
||||||
doLabelID = doLabel + "droplet_id"
|
doLabelID = doLabel + "droplet_id"
|
||||||
doLabelName = doLabel + "droplet_name"
|
doLabelName = doLabel + "droplet_name"
|
||||||
doLabelImage = doLabel + "image"
|
doLabelImage = doLabel + "image"
|
||||||
|
doLabelImageName = doLabel + "image_name"
|
||||||
doLabelPrivateIPv4 = doLabel + "private_ipv4"
|
doLabelPrivateIPv4 = doLabel + "private_ipv4"
|
||||||
doLabelPublicIPv4 = doLabel + "public_ipv4"
|
doLabelPublicIPv4 = doLabel + "public_ipv4"
|
||||||
doLabelPublicIPv6 = doLabel + "public_ipv6"
|
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)),
|
doLabelID: model.LabelValue(fmt.Sprintf("%d", droplet.ID)),
|
||||||
doLabelName: model.LabelValue(droplet.Name),
|
doLabelName: model.LabelValue(droplet.Name),
|
||||||
doLabelImage: model.LabelValue(droplet.Image.Slug),
|
doLabelImage: model.LabelValue(droplet.Image.Slug),
|
||||||
|
doLabelImageName: model.LabelValue(droplet.Image.Name),
|
||||||
doLabelPrivateIPv4: model.LabelValue(privateIPv4),
|
doLabelPrivateIPv4: model.LabelValue(privateIPv4),
|
||||||
doLabelPublicIPv4: model.LabelValue(publicIPv4),
|
doLabelPublicIPv4: model.LabelValue(publicIPv4),
|
||||||
doLabelPublicIPv6: model.LabelValue(publicIPv6),
|
doLabelPublicIPv6: model.LabelValue(publicIPv6),
|
||||||
|
|
|
@ -69,6 +69,7 @@ func TestDigitalOceanSDRefresh(t *testing.T) {
|
||||||
"__meta_digitalocean_droplet_id": model.LabelValue("3164444"),
|
"__meta_digitalocean_droplet_id": model.LabelValue("3164444"),
|
||||||
"__meta_digitalocean_droplet_name": model.LabelValue("example.com"),
|
"__meta_digitalocean_droplet_name": model.LabelValue("example.com"),
|
||||||
"__meta_digitalocean_image": model.LabelValue("ubuntu-16-04-x64"),
|
"__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_private_ipv4": model.LabelValue(""),
|
||||||
"__meta_digitalocean_public_ipv4": model.LabelValue("104.236.32.182"),
|
"__meta_digitalocean_public_ipv4": model.LabelValue("104.236.32.182"),
|
||||||
"__meta_digitalocean_public_ipv6": model.LabelValue("2604:A880:0800:0010:0000:0000:02DD:4001"),
|
"__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_id": model.LabelValue("3164494"),
|
||||||
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus"),
|
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus"),
|
||||||
"__meta_digitalocean_image": model.LabelValue("ubuntu-16-04-x64"),
|
"__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_private_ipv4": model.LabelValue(""),
|
||||||
"__meta_digitalocean_public_ipv4": model.LabelValue("104.131.186.241"),
|
"__meta_digitalocean_public_ipv4": model.LabelValue("104.131.186.241"),
|
||||||
"__meta_digitalocean_public_ipv6": model.LabelValue(""),
|
"__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_id": model.LabelValue("175072239"),
|
||||||
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo-old"),
|
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo-old"),
|
||||||
"__meta_digitalocean_image": model.LabelValue("ubuntu-18-04-x64"),
|
"__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_private_ipv4": model.LabelValue("10.135.64.211"),
|
||||||
"__meta_digitalocean_public_ipv4": model.LabelValue("167.172.111.118"),
|
"__meta_digitalocean_public_ipv4": model.LabelValue("167.172.111.118"),
|
||||||
"__meta_digitalocean_public_ipv6": model.LabelValue(""),
|
"__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_id": model.LabelValue("176011507"),
|
||||||
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo"),
|
"__meta_digitalocean_droplet_name": model.LabelValue("prometheus-demo"),
|
||||||
"__meta_digitalocean_image": model.LabelValue("ubuntu-18-04-x64"),
|
"__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_private_ipv4": model.LabelValue("10.135.64.212"),
|
||||||
"__meta_digitalocean_public_ipv4": model.LabelValue("138.65.56.69"),
|
"__meta_digitalocean_public_ipv4": model.LabelValue("138.65.56.69"),
|
||||||
"__meta_digitalocean_public_ipv6": model.LabelValue("2a03:b0c0:3:f0::cf2:4"),
|
"__meta_digitalocean_public_ipv6": model.LabelValue("2a03:b0c0:3:f0::cf2:4"),
|
||||||
|
|
|
@ -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_id`: the id of the droplet
|
||||||
* `__meta_digitalocean_droplet_name`: the name 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_private_ipv4`: the private IPv4 of the droplet
|
||||||
* `__meta_digitalocean_public_ipv4`: the public IPv4 of the droplet
|
* `__meta_digitalocean_public_ipv4`: the public IPv4 of the droplet
|
||||||
* `__meta_digitalocean_public_ipv6`: the public IPv6 of the droplet
|
* `__meta_digitalocean_public_ipv6`: the public IPv6 of the droplet
|
||||||
|
|
Loading…
Reference in a new issue