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"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -40,6 +41,7 @@ const (
|
|||
gceLabelSubnetwork = gceLabel + "subnetwork"
|
||||
gceLabelPublicIP = gceLabel + "public_ip"
|
||||
gceLabelPrivateIP = gceLabel + "private_ip"
|
||||
gceLabelInstanceID = gceLabel + "instance_id"
|
||||
gceLabelInstanceName = gceLabel + "instance_name"
|
||||
gceLabelInstanceStatus = gceLabel + "instance_status"
|
||||
gceLabelTags = gceLabel + "tags"
|
||||
|
@ -209,6 +211,7 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
|
|||
labels := model.LabelSet{
|
||||
gceLabelProject: model.LabelValue(d.project),
|
||||
gceLabelZone: model.LabelValue(inst.Zone),
|
||||
gceLabelInstanceID: model.LabelValue(strconv.FormatUint(inst.Id, 10)),
|
||||
gceLabelInstanceName: model.LabelValue(inst.Name),
|
||||
gceLabelInstanceStatus: model.LabelValue(inst.Status),
|
||||
gceLabelMachineType: model.LabelValue(inst.MachineType),
|
||||
|
|
|
@ -589,6 +589,7 @@ address with relabeling.
|
|||
|
||||
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_label_<name>`: each GCE label of the instance
|
||||
* `__meta_gce_machine_type`: full or partial URL of the machine type of the instance
|
||||
|
|
Loading…
Reference in a new issue