From bbb9b341929eb06468808d26615139f5f4026689 Mon Sep 17 00:00:00 2001 From: Steve Simpson Date: Tue, 12 Oct 2021 15:39:28 +0200 Subject: [PATCH] Use `$._config.job_names.gateway` in resources dashboards. This fixes panels where `cortex-gw` was hardcoded. --- .../dashboards/alertmanager-resources.libsonnet | 4 ++-- jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet | 8 ++++---- jsonnet/mimir-mixin/dashboards/reads-resources.libsonnet | 4 ++-- jsonnet/mimir-mixin/dashboards/writes-resources.libsonnet | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jsonnet/mimir-mixin/dashboards/alertmanager-resources.libsonnet b/jsonnet/mimir-mixin/dashboards/alertmanager-resources.libsonnet index 8a719d52f2..415060206f 100644 --- a/jsonnet/mimir-mixin/dashboards/alertmanager-resources.libsonnet +++ b/jsonnet/mimir-mixin/dashboards/alertmanager-resources.libsonnet @@ -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), diff --git a/jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet b/jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet index fe467f5b9c..981614ac83 100644 --- a/jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet +++ b/jsonnet/mimir-mixin/dashboards/dashboard-utils.libsonnet @@ -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: [ @@ -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: [ diff --git a/jsonnet/mimir-mixin/dashboards/reads-resources.libsonnet b/jsonnet/mimir-mixin/dashboards/reads-resources.libsonnet index a1b36272a3..f0750c885a 100644 --- a/jsonnet/mimir-mixin/dashboards/reads-resources.libsonnet +++ b/jsonnet/mimir-mixin/dashboards/reads-resources.libsonnet @@ -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), diff --git a/jsonnet/mimir-mixin/dashboards/writes-resources.libsonnet b/jsonnet/mimir-mixin/dashboards/writes-resources.libsonnet index 85d7f4c48b..64f83ef1cc 100644 --- a/jsonnet/mimir-mixin/dashboards/writes-resources.libsonnet +++ b/jsonnet/mimir-mixin/dashboards/writes-resources.libsonnet @@ -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),