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

Commit 9da0cf3

Browse files
committed
Use $._config.job_names.gateway in resources dashboards.
This fixes panels where `cortex-gw` was hardcoded.
1 parent 1d5e6a4 commit 9da0cf3

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
* [BUGFIX] Fixed rollout progress dashboard to include query-scheduler too. #376
6363
* [BUGFIX] Fixed `-distributor.extend-writes` setting on ruler when `unregister_ingesters_on_shutdown` is disabled. #369
6464
* [BUGFIX] Upstream recording rule `node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate` renamed. #379
65+
* [BUGFIX] Fixed writes/reads/alertmanager resources dashboards to use `$._config.job_names.gateway`. #
6566

6667
## 1.9.0 / 2021-05-18
6768

cortex-mixin/dashboards/alertmanager-resources.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
77
.addRow(
88
$.row('Gateway')
99
.addPanel(
10-
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
10+
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
1111
)
1212
.addPanel(
13-
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
13+
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
1414
)
1515
.addPanel(
1616
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),

cortex-mixin/dashboards/dashboard-utils.libsonnet

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
145145
containerCPUUsagePanel(title, containerName)::
146146
$.panel(title) +
147147
$.queryPanel([
148-
'sum by(%s) (rate(container_cpu_usage_seconds_total{%s,container="%s"}[$__rate_interval]))' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
149-
'min(container_spec_cpu_quota{%s,container="%s"} / container_spec_cpu_period{%s,container="%s"})' % [$.namespaceMatcher(), containerName, $.namespaceMatcher(), containerName],
148+
'sum by(%s) (rate(container_cpu_usage_seconds_total{%s,container=~"%s"}[$__rate_interval]))' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
149+
'min(container_spec_cpu_quota{%s,container=~"%s"} / container_spec_cpu_period{%s,container=~"%s"})' % [$.namespaceMatcher(), containerName, $.namespaceMatcher(), containerName],
150150
], ['{{%s}}' % $._config.per_instance_label, 'limit']) +
151151
{
152152
seriesOverrides: [
@@ -164,8 +164,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
164164
$.queryPanel([
165165
// We use "max" instead of "sum" otherwise during a rolling update of a statefulset we will end up
166166
// summing the memory of the old instance/pod (whose metric will be stale for 5m) to the new instance/pod.
167-
'max by(%s) (container_memory_working_set_bytes{%s,container="%s"})' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
168-
'min(container_spec_memory_limit_bytes{%s,container="%s"} > 0)' % [$.namespaceMatcher(), containerName],
167+
'max by(%s) (container_memory_working_set_bytes{%s,container=~"%s"})' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
168+
'min(container_spec_memory_limit_bytes{%s,container=~"%s"} > 0)' % [$.namespaceMatcher(), containerName],
169169
], ['{{%s}}' % $._config.per_instance_label, 'limit']) +
170170
{
171171
seriesOverrides: [

cortex-mixin/dashboards/reads-resources.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
77
.addRow(
88
$.row('Gateway')
99
.addPanel(
10-
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
10+
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
1111
)
1212
.addPanel(
13-
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
13+
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
1414
)
1515
.addPanel(
1616
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),

cortex-mixin/dashboards/writes-resources.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
77
.addRow(
88
$.row('Gateway')
99
.addPanel(
10-
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
10+
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
1111
)
1212
.addPanel(
13-
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
13+
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
1414
)
1515
.addPanel(
1616
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),

0 commit comments

Comments
 (0)