github.com/google/cloudprober@v0.11.3/docs/content/how-to/additional-labels.md (about) 1 --- 2 menu: 3 main: 4 parent: "How-Tos" 5 weight: 26 6 title: "Additional Labels" 7 date: 2021-06-28T17:24:32-07:00 8 --- 9 ## Adding additional labels 10 11 You can add additional labels to probe metrics using a probe-level field: `additional_label`. An additional label's value can be static, or it can be determined at the run-time: from the environment that the probe is running in (e.g. GCE instance labels), or target's labels. 12 13 Example config [here](https://github.com/google/cloudprober/blob/master/examples/additional_label/cloudprober.cfg) demonstrates adding various types of additional labels to probe metrics. For this config (also listed below for quick rerefence): 14 15 * if ingress target has label "`fqdn:app.example.com`", 16 * and prober is running in the GCE zone `us-east1-c`, 17 * and prober's GCE instance has label `env:prod`. 18 19 Probe metrics will look like the following: 20 ``` 21 total{probe="my_ingress",ptype="http",metrictype="prober",env="prod",src_zone="us-east1-c",host="app.example.com"}: 90 22 success{probe="my_ingress",ptype="http",metrictype="prober",env="prod",src_zone="us-east1-c",host="app.example.com"}: 80 23 ``` 24 25 26 27 ```bash 28 probe { 29 name: "my_ingress" 30 type: HTTP 31 32 targets { 33 rds_targets { 34 resource_path: "k8s://ingresses" 35 filter { 36 key: "namespace" 37 value: "default" 38 } 39 } 40 } 41 42 # Static label 43 additional_label { 44 key: "metrictype" 45 value: "prober" 46 } 47 48 # Label is configured at the run-time, based on the prober instance label (GCE). 49 additional_label { 50 key: "env" 51 value: "{{.label_env}}" 52 } 53 54 # Label is configured at the run-time, based on the prober environment (GCE). 55 additional_label { 56 key: "src_zone" 57 value: "{{.zone}}" 58 } 59 60 # Label is configured based on the target's labels. 61 additional_label { 62 key: "host" 63 value: "@target.label.fqdn@" 64 } 65 66 http_probe {} 67 } 68 ``` 69 (Listing source: [examples/additional_label/cloudprober.cfg](https://github.com/google/cloudprober/blob/master/examples/additional_label/cloudprober.cfg)) 70 71 ## Adding your own metrics 72 For external probes, Cloudprober also allows external programs to provide additional metrics. 73 See [External Probe](https://cloudprober.org/how-to/external-probe) for more details. 74