Skip to content

Commit db05c86

Browse files
authored
Merge pull request grafana#403 from stevesg/gateway-container-names
Use `$._config.job_names.gateway` in resources dashboards.
2 parents b751414 + 93abac9 commit db05c86

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
@@ -73,6 +73,7 @@
7373
* [BUGFIX] Fixed `-distributor.extend-writes` setting on ruler when `unregister_ingesters_on_shutdown` is disabled. #369
7474
* [BUGFIX] Upstream recording rule `node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate` renamed. #379
7575
* [BUGFIX] Treat `compactor_blocks_retention_period` type as string rather than int.#395
76+
* [BUGFIX] Fixed writes/reads/alertmanager resources dashboards to use `$._config.job_names.gateway`. #403
7677

7778
## 1.9.0 / 2021-05-18
7879

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)