Skip to content

Commit d7e08db

Browse files
committed
Add alert and dashboard using config file hashes
This allow to monitor the roll out of new config file versions to the various nodes of a cluster. The metric was added as part of cortexproject/cortex#2874.
1 parent f9543b0 commit d7e08db

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

cortex-mixin/alerts/alerts.libsonnet

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@
9191
|||,
9292
},
9393
},
94+
{
95+
alert: 'CortexInconsistentConfig',
96+
expr: |||
97+
count(count by(%s, sha256) (cortex_config_hash)) without(sha256) > 1
98+
||| % $._config.alert_aggregation_labels,
99+
'for': '1h',
100+
labels: {
101+
severity: 'warning',
102+
},
103+
annotations: {
104+
message: |||
105+
An inconsistent config file hash is used across cluster {{ $labels.job }}.
106+
|||,
107+
},
108+
},
94109
{
95110
// As of https://github.com/cortexproject/cortex/pull/2092, this metric is
96111
// only exposed when it is supposed to be non-zero, so we don't need to do

cortex-mixin/dashboards.libsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
grafanaDashboards+:
3+
(import 'dashboards/config.libsonnet') +
34
(import 'dashboards/queries.libsonnet') +
45
(import 'dashboards/reads.libsonnet') +
56
(import 'dashboards/ruler.libsonnet') +
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
local utils = import 'mixin-utils/utils.libsonnet';
2+
3+
(import 'dashboard-utils.libsonnet') {
4+
5+
'cortex-config.json':
6+
$.dashboard('Cortex / Config')
7+
.addClusterSelectorTemplates()
8+
.addRow(
9+
$.row('Startup config file')
10+
.addPanel(
11+
$.panel('Startup config file hashes') +
12+
$.queryPanel('count(cortex_config_hash) by (sha256)', 'sha256:{{sha256}}') +
13+
$.stack +
14+
{ yaxes: $.yaxes('instances') },
15+
)
16+
)
17+
.addRow(
18+
$.row('Runtime config file')
19+
.addPanel(
20+
$.panel('Runtime config file hashes') +
21+
$.queryPanel('count(cortex_runtime_config_hash) by (sha256)', 'sha256:{{sha256}}') +
22+
$.stack +
23+
{ yaxes: $.yaxes('instances') },
24+
)
25+
),
26+
}

0 commit comments

Comments
 (0)