diff --git a/cortex-mixin/alerts/alerts.libsonnet b/cortex-mixin/alerts/alerts.libsonnet index a4a1e05b..04dc7b01 100644 --- a/cortex-mixin/alerts/alerts.libsonnet +++ b/cortex-mixin/alerts/alerts.libsonnet @@ -91,6 +91,21 @@ |||, }, }, + { + alert: 'CortexInconsistentConfig', + expr: ||| + count(count by(%s, job, sha256) (cortex_config_hash)) without(sha256) > 1 + ||| % $._config.alert_aggregation_labels, + 'for': '1h', + labels: { + severity: 'warning', + }, + annotations: { + message: ||| + An inconsistent config file hash is used across cluster {{ $labels.job }}. + |||, + }, + }, { // As of https://github.com/cortexproject/cortex/pull/2092, this metric is // only exposed when it is supposed to be non-zero, so we don't need to do diff --git a/cortex-mixin/dashboards.libsonnet b/cortex-mixin/dashboards.libsonnet index 3eacaeb6..3016a56f 100644 --- a/cortex-mixin/dashboards.libsonnet +++ b/cortex-mixin/dashboards.libsonnet @@ -1,5 +1,6 @@ { grafanaDashboards+: + (import 'dashboards/config.libsonnet') + (import 'dashboards/queries.libsonnet') + (import 'dashboards/reads.libsonnet') + (import 'dashboards/ruler.libsonnet') + diff --git a/cortex-mixin/dashboards/config.libsonnet b/cortex-mixin/dashboards/config.libsonnet new file mode 100644 index 00000000..eedfcb4c --- /dev/null +++ b/cortex-mixin/dashboards/config.libsonnet @@ -0,0 +1,26 @@ +local utils = import 'mixin-utils/utils.libsonnet'; + +(import 'dashboard-utils.libsonnet') { + + 'cortex-config.json': + $.dashboard('Cortex / Config') + .addClusterSelectorTemplates() + .addRow( + $.row('Startup config file') + .addPanel( + $.panel('Startup config file hashes') + + $.queryPanel('count(cortex_config_hash{%s}) by (sha256)' % $.namespaceMatcher(), 'sha256:{{sha256}}') + + $.stack + + { yaxes: $.yaxes('instances') }, + ) + ) + .addRow( + $.row('Runtime config file') + .addPanel( + $.panel('Runtime config file hashes') + + $.queryPanel('count(cortex_runtime_config_hash{%s}) by (sha256)' % $.namespaceMatcher(), 'sha256:{{sha256}}') + + $.stack + + { yaxes: $.yaxes('instances') }, + ) + ), +}