Skip to content

Commit 23ea54e

Browse files
committed
Add __replica__ labels to prometheus-ha replicas
Those labels are needed by Cortex for deduplication. In our existing setup, we use "one" and "two" as labels. Here I have chosen "zero" and "one", in line with the zero-based numbering within a stateful set. I expect that this should not make any difference for Cortex. It only matters that both label values are different.
1 parent 4cfedad commit 23ea54e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

prometheus-ksonnet/lib/prometheus-ha-mixin.libsonnet

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ local configMap = k.core.v1.configMap;
1010
prometheus_config_file: '/etc/$(POD_NAME)/prometheus.yml',
1111
},
1212

13+
// The '__replica__' label is used by Cortex for deduplication.
1314
prometheus_zero+:: {
14-
config+:: root.prometheus_config,
15+
config+:: root.prometheus_config {
16+
global+: {
17+
external_labels+: {
18+
__replica__: 'zero',
19+
},
20+
},
21+
},
1522
alerts+:: root.prometheusAlerts,
1623
rules+:: root.prometheusRules,
1724
},
1825

1926
prometheus_one+:: {
20-
config+:: root.prometheus_config,
27+
config+:: root.prometheus_config {
28+
global+: {
29+
external_labels+: {
30+
__replica__: 'one',
31+
},
32+
},
33+
},
2134
alerts+:: root.prometheusAlerts,
2235
rules+:: root.prometheusRules,
2336
},

0 commit comments

Comments
 (0)