Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rollout dashboard to work with multi-zone deployments #366

Merged
merged 2 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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