mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 22:07:27 -08:00
Merge pull request #4488 from jkohen/patch-3
Populate __meta_gce_instance_id discovery label
This commit is contained in:
commit
b04ab71268
|
@ -17,6 +17,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ const (
|
||||||
gceLabelSubnetwork = gceLabel + "subnetwork"
|
gceLabelSubnetwork = gceLabel + "subnetwork"
|
||||||
gceLabelPublicIP = gceLabel + "public_ip"
|
gceLabelPublicIP = gceLabel + "public_ip"
|
||||||
gceLabelPrivateIP = gceLabel + "private_ip"
|
gceLabelPrivateIP = gceLabel + "private_ip"
|
||||||
|
gceLabelInstanceID = gceLabel + "instance_id"
|
||||||
gceLabelInstanceName = gceLabel + "instance_name"
|
gceLabelInstanceName = gceLabel + "instance_name"
|
||||||
gceLabelInstanceStatus = gceLabel + "instance_status"
|
gceLabelInstanceStatus = gceLabel + "instance_status"
|
||||||
gceLabelTags = gceLabel + "tags"
|
gceLabelTags = gceLabel + "tags"
|
||||||
|
@ -209,6 +211,7 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
|
||||||
labels := model.LabelSet{
|
labels := model.LabelSet{
|
||||||
gceLabelProject: model.LabelValue(d.project),
|
gceLabelProject: model.LabelValue(d.project),
|
||||||
gceLabelZone: model.LabelValue(inst.Zone),
|
gceLabelZone: model.LabelValue(inst.Zone),
|
||||||
|
gceLabelInstanceID: model.LabelValue(strconv.FormatUint(inst.Id, 10)),
|
||||||
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),
|
gceLabelMachineType: model.LabelValue(inst.MachineType),
|
||||||
|
|
|
@ -589,6 +589,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_id`: the numeric id of the instance
|
||||||
* `__meta_gce_instance_name`: the name of the instance
|
* `__meta_gce_instance_name`: the name of the instance
|
||||||
* `__meta_gce_label_<name>`: each GCE label of the instance
|
* `__meta_gce_label_<name>`: each GCE label of the instance
|
||||||
* `__meta_gce_machine_type`: full or partial URL of the machine type of the instance
|
* `__meta_gce_machine_type`: full or partial URL of the machine type of the instance
|
||||||
|
|
Loading…
Reference in a new issue