Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit a337270

Browse files
authored
Merge pull request #366 from grafana/fix-multi-zone-rollout-dashboard
Fix rollout dashboard to work with multi-zone deployments
2 parents dccf32a + 796e68f commit a337270

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* [BUGFIX] Alertmanager: fixed `--alertmanager.cluster.peers` CLI flag passed to alertmanager when HA is enabled. #329
3737
* [BUGFIX] Fixed `CortexInconsistentRuntimeConfig` metric. #335
3838
* [BUGFIX] Fixed scaling dashboard to correctly work when a Cortex service deployment spans across multiple zones (a zone is expected to have the `zone-[a-z]` suffix). #365
39+
* [BUGFIX] Fixed rollout progress dashboard to correctly work when a Cortex service deployment spans across multiple zones (a zone is expected to have the `zone-[a-z]` suffix). #366
3940

4041
## 1.9.0 / 2021-05-18
4142

cortex-mixin/dashboards/rollout-progress.libsonnet

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
66
gateway_job_matcher: $.jobMatcher($._config.job_names.gateway),
77
gateway_write_routes_regex: 'api_(v1|prom)_push',
88
gateway_read_routes_regex: '(prometheus|api_prom)_api_v1_.+',
9-
all_services_regex: std.join('|', ['cortex-gw', 'distributor', 'ingester', 'query-frontend', 'querier', 'compactor', 'store-gateway', 'ruler', 'alertmanager']),
9+
all_services_regex: std.join('|', ['cortex-gw', 'distributor', 'ingester.*', 'query-frontend', 'querier', 'compactor', 'store-gateway', 'ruler', 'alertmanager']),
1010
},
1111

1212
'cortex-rollout-progress.json':
@@ -22,29 +22,61 @@ local utils = import 'mixin-utils/utils.libsonnet';
2222
//
2323
$.panel('Rollout progress') +
2424
$.barGauge([
25+
// Multi-zone deployments are grouped together removing the "zone-X" suffix.
26+
// After the grouping, the resulting label is called "cortex_service".
2527
|||
2628
(
27-
kube_statefulset_status_replicas_updated{%(namespace_matcher)s,statefulset=~"%(all_services_regex)s"}
29+
sum by(cortex_service) (
30+
label_replace(
31+
kube_statefulset_status_replicas_updated{%(namespace_matcher)s,statefulset=~"%(all_services_regex)s"},
32+
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
33+
)
34+
)
2835
/
29-
kube_statefulset_replicas{%(namespace_matcher)s}
36+
sum by(cortex_service) (
37+
label_replace(
38+
kube_statefulset_replicas{%(namespace_matcher)s},
39+
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
40+
)
41+
)
3042
) and (
31-
kube_statefulset_replicas{%(namespace_matcher)s}
43+
sum by(cortex_service) (
44+
label_replace(
45+
kube_statefulset_replicas{%(namespace_matcher)s},
46+
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
47+
)
48+
)
3249
> 0
3350
)
3451
||| % config,
3552
|||
3653
(
37-
kube_deployment_status_replicas_updated{%(namespace_matcher)s,deployment=~"%(all_services_regex)s"}
54+
sum by(cortex_service) (
55+
label_replace(
56+
kube_deployment_status_replicas_updated{%(namespace_matcher)s,deployment=~"%(all_services_regex)s"},
57+
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
58+
)
59+
)
3860
/
39-
kube_deployment_spec_replicas{%(namespace_matcher)s}
61+
sum by(cortex_service) (
62+
label_replace(
63+
kube_deployment_spec_replicas{%(namespace_matcher)s},
64+
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
65+
)
66+
)
4067
) and (
41-
kube_deployment_spec_replicas{%(namespace_matcher)s}
68+
sum by(cortex_service) (
69+
label_replace(
70+
kube_deployment_spec_replicas{%(namespace_matcher)s},
71+
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
72+
)
73+
)
4274
> 0
4375
)
4476
||| % config,
4577
], legends=[
46-
'{{statefulset}}',
47-
'{{deployment}}',
78+
'{{cortex_service}}',
79+
'{{cortex_service}}',
4880
], thresholds=[
4981
{ color: 'yellow', value: null },
5082
{ color: 'yellow', value: 0.999 },

0 commit comments

Comments
 (0)