Skip to content

Commit

Permalink
Merge pull request #366 from grafana/fix-multi-zone-rollout-dashboard
Browse files Browse the repository at this point in the history
Fix rollout dashboard to work with multi-zone deployments
  • Loading branch information
pracucci authored Jul 29, 2021
2 parents dccf32a + 796e68f commit a337270
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* [BUGFIX] Alertmanager: fixed `--alertmanager.cluster.peers` CLI flag passed to alertmanager when HA is enabled. #329
* [BUGFIX] Fixed `CortexInconsistentRuntimeConfig` metric. #335
* [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
* [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

## 1.9.0 / 2021-05-18

Expand Down
50 changes: 41 additions & 9 deletions cortex-mixin/dashboards/rollout-progress.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
gateway_job_matcher: $.jobMatcher($._config.job_names.gateway),
gateway_write_routes_regex: 'api_(v1|prom)_push',
gateway_read_routes_regex: '(prometheus|api_prom)_api_v1_.+',
all_services_regex: std.join('|', ['cortex-gw', 'distributor', 'ingester', 'query-frontend', 'querier', 'compactor', 'store-gateway', 'ruler', 'alertmanager']),
all_services_regex: std.join('|', ['cortex-gw', 'distributor', 'ingester.*', 'query-frontend', 'querier', 'compactor', 'store-gateway', 'ruler', 'alertmanager']),
},

'cortex-rollout-progress.json':
Expand All @@ -22,29 +22,61 @@ local utils = import 'mixin-utils/utils.libsonnet';
//
$.panel('Rollout progress') +
$.barGauge([
// Multi-zone deployments are grouped together removing the "zone-X" suffix.
// After the grouping, the resulting label is called "cortex_service".
|||
(
kube_statefulset_status_replicas_updated{%(namespace_matcher)s,statefulset=~"%(all_services_regex)s"}
sum by(cortex_service) (
label_replace(
kube_statefulset_status_replicas_updated{%(namespace_matcher)s,statefulset=~"%(all_services_regex)s"},
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
)
)
/
kube_statefulset_replicas{%(namespace_matcher)s}
sum by(cortex_service) (
label_replace(
kube_statefulset_replicas{%(namespace_matcher)s},
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
)
)
) and (
kube_statefulset_replicas{%(namespace_matcher)s}
sum by(cortex_service) (
label_replace(
kube_statefulset_replicas{%(namespace_matcher)s},
"cortex_service", "$1", "statefulset", "(.*?)(?:-zone-[a-z])?"
)
)
> 0
)
||| % config,
|||
(
kube_deployment_status_replicas_updated{%(namespace_matcher)s,deployment=~"%(all_services_regex)s"}
sum by(cortex_service) (
label_replace(
kube_deployment_status_replicas_updated{%(namespace_matcher)s,deployment=~"%(all_services_regex)s"},
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
)
)
/
kube_deployment_spec_replicas{%(namespace_matcher)s}
sum by(cortex_service) (
label_replace(
kube_deployment_spec_replicas{%(namespace_matcher)s},
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
)
)
) and (
kube_deployment_spec_replicas{%(namespace_matcher)s}
sum by(cortex_service) (
label_replace(
kube_deployment_spec_replicas{%(namespace_matcher)s},
"cortex_service", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
)
)
> 0
)
||| % config,
], legends=[
'{{statefulset}}',
'{{deployment}}',
'{{cortex_service}}',
'{{cortex_service}}',
], thresholds=[
{ color: 'yellow', value: null },
{ color: 'yellow', value: 0.999 },
Expand Down

0 comments on commit a337270

Please sign in to comment.