From 0245fd55bf6e250461540e85c9783441e64817b2 Mon Sep 17 00:00:00 2001 From: albatross0 Date: Sat, 31 Mar 2018 17:20:19 +0900 Subject: [PATCH] Add a machine type label to GCE SD (#4032) --- discovery/gce/gce.go | 2 ++ docs/configuration/configuration.md | 1 + 2 files changed, 3 insertions(+) diff --git a/discovery/gce/gce.go b/discovery/gce/gce.go index dcba4bd3f..d8a03968a 100644 --- a/discovery/gce/gce.go +++ b/discovery/gce/gce.go @@ -45,6 +45,7 @@ const ( gceLabelInstanceStatus = gceLabel + "instance_status" gceLabelTags = gceLabel + "tags" gceLabelMetadata = gceLabel + "metadata_" + gceLabelMachineType = gceLabel + "machine_type" ) var ( @@ -216,6 +217,7 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) { gceLabelZone: model.LabelValue(inst.Zone), gceLabelInstanceName: model.LabelValue(inst.Name), gceLabelInstanceStatus: model.LabelValue(inst.Status), + gceLabelMachineType: model.LabelValue(inst.MachineType), } priIface := inst.NetworkInterfaces[0] labels[gceLabelNetwork] = model.LabelValue(priIface.Network) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 59418078b..7378efa4a 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -577,6 +577,7 @@ address with relabeling. The following meta labels are available on targets during [relabeling](#relabel_config): * `__meta_gce_instance_name`: the name of the instance +* `__meta_gce_machine_type`: full or partial URL of the machine type of the instance * `__meta_gce_metadata_`: each metadata item of the instance * `__meta_gce_network`: the network URL of the instance * `__meta_gce_private_ip`: the private IP address of the instance