|
6 | 6 | [id="attaching-additional-labels-to-your-time-series-and-alerts_{context}"] |
7 | 7 | = Attaching additional labels to your time series and alerts |
8 | 8 |
|
9 | | -Using the external labels feature of Prometheus, you can attach custom labels to all time series and alerts leaving Prometheus. |
| 9 | +You can attach custom labels to all time series and alerts leaving Prometheus by using the external labels feature of Prometheus. |
10 | 10 |
|
11 | 11 | .Prerequisites |
12 | 12 |
|
@@ -49,17 +49,19 @@ data: |
49 | 49 | config.yaml: | |
50 | 50 | prometheusK8s: |
51 | 51 | externalLabels: |
52 | | - <key>: <value> <1> |
| 52 | + <key>: <value> # <1> |
53 | 53 | ---- |
54 | 54 | + |
55 | 55 | <1> Substitute `<key>: <value>` with a map of key-value pairs where `<key>` is a unique name for the new label and `<value>` is its value. |
56 | 56 | + |
57 | 57 | [WARNING] |
58 | 58 | ==== |
59 | | -Do not use `prometheus` or `prometheus_replica` as key names, because they are reserved and will be overwritten. |
| 59 | +* Do not use `prometheus` or `prometheus_replica` as key names, because they are reserved and will be overwritten. |
| 60 | +
|
| 61 | +* Do not use `cluster` or `managed_cluster` as key names. Using them can cause issues where you are unable to see data in the developer dashboards. |
60 | 62 | ==== |
61 | 63 | + |
62 | | -For example, to add metadata about the region and environment to all time series and alerts, use: |
| 64 | +For example, to add metadata about the region and environment to all time series and alerts, use the following example: |
63 | 65 | + |
64 | 66 | [source,yaml] |
65 | 67 | ---- |
@@ -98,22 +100,24 @@ data: |
98 | 100 | config.yaml: | |
99 | 101 | prometheus: |
100 | 102 | externalLabels: |
101 | | - <key>: <value> <1> |
| 103 | + <key>: <value> # <1> |
102 | 104 | ---- |
103 | 105 | + |
104 | 106 | <1> Substitute `<key>: <value>` with a map of key-value pairs where `<key>` is a unique name for the new label and `<value>` is its value. |
105 | 107 | + |
106 | 108 | [WARNING] |
107 | 109 | ==== |
108 | | -Do not use `prometheus` or `prometheus_replica` as key names, because they are reserved and will be overwritten. |
| 110 | +* Do not use `prometheus` or `prometheus_replica` as key names, because they are reserved and will be overwritten. |
| 111 | +
|
| 112 | +* Do not use `cluster` or `managed_cluster` as key names. Using them can cause issues where you are unable to see data in the developer dashboards. |
109 | 113 | ==== |
110 | 114 | + |
111 | 115 | [NOTE] |
112 | 116 | ==== |
113 | 117 | In the `openshift-user-workload-monitoring` project, Prometheus handles metrics and Thanos Ruler handles alerting and recording rules. Setting `externalLabels` for `prometheus` in the `user-workload-monitoring-config` `ConfigMap` object will only configure external labels for metrics and not for any rules. |
114 | 118 | ==== |
115 | 119 | + |
116 | | -For example, to add metadata about the region and environment to all time series and alerts related to user-defined projects, use: |
| 120 | +For example, to add metadata about the region and environment to all time series and alerts related to user-defined projects, use the following example: |
117 | 121 | + |
118 | 122 | [source,yaml] |
119 | 123 | ---- |
|
0 commit comments