Add a machine type label to GCE SD (#4032)

This commit is contained in:
albatross0 2018-03-31 17:20:19 +09:00 committed by Brian Brazil
parent be85ba3842
commit 0245fd55bf
2 changed files with 3 additions and 0 deletions

View file

@ -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)

View file

@ -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_<name>`: 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