Skip to content

Commit

Permalink
Use $._config.job_names.gateway in resources dashboards.
Browse files Browse the repository at this point in the history
This fixes panels where `cortex-gw` was hardcoded.
  • Loading branch information
stevesg committed Oct 12, 2021
1 parent 1d5e6a4 commit 9da0cf3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
* [BUGFIX] Fixed rollout progress dashboard to include query-scheduler too. #376
* [BUGFIX] Fixed `-distributor.extend-writes` setting on ruler when `unregister_ingesters_on_shutdown` is disabled. #369
* [BUGFIX] Upstream recording rule `node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate` renamed. #379
* [BUGFIX] Fixed writes/reads/alertmanager resources dashboards to use `$._config.job_names.gateway`. #

## 1.9.0 / 2021-05-18

Expand Down
4 changes: 2 additions & 2 deletions cortex-mixin/dashboards/alertmanager-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Gateway')
.addPanel(
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
)
.addPanel(
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
)
.addPanel(
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),
Expand Down
8 changes: 4 additions & 4 deletions cortex-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
containerCPUUsagePanel(title, containerName)::
$.panel(title) +
$.queryPanel([
'sum by(%s) (rate(container_cpu_usage_seconds_total{%s,container="%s"}[$__rate_interval]))' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
'min(container_spec_cpu_quota{%s,container="%s"} / container_spec_cpu_period{%s,container="%s"})' % [$.namespaceMatcher(), containerName, $.namespaceMatcher(), containerName],
'sum by(%s) (rate(container_cpu_usage_seconds_total{%s,container=~"%s"}[$__rate_interval]))' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
'min(container_spec_cpu_quota{%s,container=~"%s"} / container_spec_cpu_period{%s,container=~"%s"})' % [$.namespaceMatcher(), containerName, $.namespaceMatcher(), containerName],
], ['{{%s}}' % $._config.per_instance_label, 'limit']) +
{
seriesOverrides: [
Expand All @@ -164,8 +164,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.queryPanel([
// We use "max" instead of "sum" otherwise during a rolling update of a statefulset we will end up
// summing the memory of the old instance/pod (whose metric will be stale for 5m) to the new instance/pod.
'max by(%s) (container_memory_working_set_bytes{%s,container="%s"})' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
'min(container_spec_memory_limit_bytes{%s,container="%s"} > 0)' % [$.namespaceMatcher(), containerName],
'max by(%s) (container_memory_working_set_bytes{%s,container=~"%s"})' % [$._config.per_instance_label, $.namespaceMatcher(), containerName],
'min(container_spec_memory_limit_bytes{%s,container=~"%s"} > 0)' % [$.namespaceMatcher(), containerName],
], ['{{%s}}' % $._config.per_instance_label, 'limit']) +
{
seriesOverrides: [
Expand Down
4 changes: 2 additions & 2 deletions cortex-mixin/dashboards/reads-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Gateway')
.addPanel(
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
)
.addPanel(
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
)
.addPanel(
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),
Expand Down
4 changes: 2 additions & 2 deletions cortex-mixin/dashboards/writes-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Gateway')
.addPanel(
$.containerCPUUsagePanel('CPU', 'cortex-gw'),
$.containerCPUUsagePanel('CPU', $._config.job_names.gateway),
)
.addPanel(
$.containerMemoryWorkingSetPanel('Memory (workingset)', 'cortex-gw'),
$.containerMemoryWorkingSetPanel('Memory (workingset)', $._config.job_names.gateway),
)
.addPanel(
$.goHeapInUsePanel('Memory (go heap inuse)', $._config.job_names.gateway),
Expand Down

0 comments on commit 9da0cf3

Please sign in to comment.