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

pull/4034/head
albatross0 7 years ago committed by Brian Brazil
parent be85ba3842
commit 0245fd55bf

@ -45,6 +45,7 @@ const (
gceLabelInstanceStatus = gceLabel + "instance_status" gceLabelInstanceStatus = gceLabel + "instance_status"
gceLabelTags = gceLabel + "tags" gceLabelTags = gceLabel + "tags"
gceLabelMetadata = gceLabel + "metadata_" gceLabelMetadata = gceLabel + "metadata_"
gceLabelMachineType = gceLabel + "machine_type"
) )
var ( var (
@ -216,6 +217,7 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
gceLabelZone: model.LabelValue(inst.Zone), gceLabelZone: model.LabelValue(inst.Zone),
gceLabelInstanceName: model.LabelValue(inst.Name), gceLabelInstanceName: model.LabelValue(inst.Name),
gceLabelInstanceStatus: model.LabelValue(inst.Status), gceLabelInstanceStatus: model.LabelValue(inst.Status),
gceLabelMachineType: model.LabelValue(inst.MachineType),
} }
priIface := inst.NetworkInterfaces[0] priIface := inst.NetworkInterfaces[0]
labels[gceLabelNetwork] = model.LabelValue(priIface.Network) labels[gceLabelNetwork] = model.LabelValue(priIface.Network)

@ -577,6 +577,7 @@ address with relabeling.
The following meta labels are available on targets during [relabeling](#relabel_config): The following meta labels are available on targets during [relabeling](#relabel_config):
* `__meta_gce_instance_name`: the name of the instance * `__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_metadata_<name>`: each metadata item of the instance
* `__meta_gce_network`: the network URL of the instance * `__meta_gce_network`: the network URL of the instance
* `__meta_gce_private_ip`: the private IP address of the instance * `__meta_gce_private_ip`: the private IP address of the instance

Loading…
Cancel
Save