From 756ae748b50c123d071571e4a47cd82836544c0b Mon Sep 17 00:00:00 2001 From: Josh Carp Date: Tue, 26 Apr 2022 12:41:21 -0400 Subject: [PATCH 1/2] dashboards: add flag to skip gateway The gateway component seems to be an enterprise component, so groups that aren't running enterprise shouldn't need the empty panels and rows in their dashboards. This patch adds a flag to drop gateway-related widgets from the mixin dashboards. Signed-off-by: Josh Carp --- CHANGELOG.md | 1 + operations/mimir-mixin/config.libsonnet | 3 +++ .../dashboards/alertmanager-resources.libsonnet | 3 ++- operations/mimir-mixin/dashboards/alertmanager.libsonnet | 3 ++- .../mimir-mixin/dashboards/dashboard-utils.libsonnet | 8 ++++++++ .../mimir-mixin/dashboards/reads-networking.libsonnet | 2 +- .../mimir-mixin/dashboards/reads-resources.libsonnet | 3 ++- operations/mimir-mixin/dashboards/reads.libsonnet | 3 ++- operations/mimir-mixin/dashboards/ruler.libsonnet | 3 ++- .../mimir-mixin/dashboards/writes-networking.libsonnet | 2 +- .../mimir-mixin/dashboards/writes-resources.libsonnet | 3 ++- operations/mimir-mixin/dashboards/writes.libsonnet | 6 ++++-- 12 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4adc26a6650..9de738bd226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ * [ENHANCEMENT] Dashboards: Show QPS and latency of the Alertmanager Distributor. #1696 * [ENHANCEMENT] Playbooks: Add Alertmanager suggestions for `MimirRequestErrors` and `MimirRequestLatency` #1702 * [ENHANCEMENT] Dashboards: Allow custom datasources. #1749 +* [ENHANCEMENT] Dashboards: Optionally drop gateway widgets. #1761 * [BUGFIX] Dashboards: Fix "Failed evaluation rate" panel on Tenants dashboard. #1629 * [BUGFIX] Honor the configured `per_instance_label` in all dashboards and alerts. #1697 diff --git a/operations/mimir-mixin/config.libsonnet b/operations/mimir-mixin/config.libsonnet index c02eb76bcb1..136f4106d34 100644 --- a/operations/mimir-mixin/config.libsonnet +++ b/operations/mimir-mixin/config.libsonnet @@ -47,6 +47,9 @@ // Whether resources dashboards are enabled (based on cAdvisor metrics). resources_dashboards_enabled: true, + // Whether mimir gateway is enabled + gateway_enabled: true, + // The label used to differentiate between different application instances (i.e. 'pod' in a kubernetes install). per_instance_label: 'pod', diff --git a/operations/mimir-mixin/dashboards/alertmanager-resources.libsonnet b/operations/mimir-mixin/dashboards/alertmanager-resources.libsonnet index 20385bf1e5c..6bc12530ac2 100644 --- a/operations/mimir-mixin/dashboards/alertmanager-resources.libsonnet +++ b/operations/mimir-mixin/dashboards/alertmanager-resources.libsonnet @@ -4,7 +4,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; 'mimir-alertmanager-resources.json': ($.dashboard('Alertmanager resources') + { uid: '68b66aed90ccab448009089544a8d6c6' }) .addClusterSelectorTemplates(false) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Gateway') .addPanel( $.containerCPUUsagePanel('CPU', $._config.job_names.gateway), diff --git a/operations/mimir-mixin/dashboards/alertmanager.libsonnet b/operations/mimir-mixin/dashboards/alertmanager.libsonnet index 43c2f9392f1..870586e23a9 100644 --- a/operations/mimir-mixin/dashboards/alertmanager.libsonnet +++ b/operations/mimir-mixin/dashboards/alertmanager.libsonnet @@ -88,7 +88,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; $.latencyPanel('cortex_alertmanager_notification_latency_seconds', '{%s}' % $.jobMatcher($._config.job_names.alertmanager)) ) ) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Configuration API (gateway) + Alertmanager UI') .addPanel( $.panel('QPS') + diff --git a/operations/mimir-mixin/dashboards/dashboard-utils.libsonnet b/operations/mimir-mixin/dashboards/dashboard-utils.libsonnet index 12046114b1f..b053e7beab2 100644 --- a/operations/mimir-mixin/dashboards/dashboard-utils.libsonnet +++ b/operations/mimir-mixin/dashboards/dashboard-utils.libsonnet @@ -4,6 +4,14 @@ local utils = import 'mixin-utils/utils.libsonnet'; _config:: error 'must provide _config', + row(title):: + super.row(title) + { + addPanelIf(condition, panel):: + if condition + then self.addPanel(panel) + else self, + }, + // Override the dashboard constructor to add: // - default tags, // - some links that propagate the selectred cluster. diff --git a/operations/mimir-mixin/dashboards/reads-networking.libsonnet b/operations/mimir-mixin/dashboards/reads-networking.libsonnet index f8e9cfcd969..7023aef320b 100644 --- a/operations/mimir-mixin/dashboards/reads-networking.libsonnet +++ b/operations/mimir-mixin/dashboards/reads-networking.libsonnet @@ -4,7 +4,7 @@ local utils = import 'mixin-utils/utils.libsonnet'; 'mimir-reads-networking.json': ($.dashboard('Reads networking') + { uid: 'c0464f0d8bd026f776c9006b05910000' }) .addClusterSelectorTemplates(false) - .addRow($.jobNetworkingRow('Gateway', 'gateway')) + .addRowIf($._config.gateway_enabled, $.jobNetworkingRow('Gateway', 'gateway')) .addRow($.jobNetworkingRow('Query-frontend', 'query_frontend')) .addRow($.jobNetworkingRow('Query-scheduler', 'query_scheduler')) .addRow($.jobNetworkingRow('Querier', 'querier')) diff --git a/operations/mimir-mixin/dashboards/reads-resources.libsonnet b/operations/mimir-mixin/dashboards/reads-resources.libsonnet index 7661df45aac..287446d8dfd 100644 --- a/operations/mimir-mixin/dashboards/reads-resources.libsonnet +++ b/operations/mimir-mixin/dashboards/reads-resources.libsonnet @@ -4,7 +4,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; 'mimir-reads-resources.json': ($.dashboard('Reads resources') + { uid: '2fd2cda9eea8d8af9fbc0a5960425120' }) .addClusterSelectorTemplates(false) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Gateway') .addPanel( $.containerCPUUsagePanel('CPU', $._config.job_names.gateway), diff --git a/operations/mimir-mixin/dashboards/reads.libsonnet b/operations/mimir-mixin/dashboards/reads.libsonnet index 48a2794f0c9..bdad80da2e8 100644 --- a/operations/mimir-mixin/dashboards/reads.libsonnet +++ b/operations/mimir-mixin/dashboards/reads.libsonnet @@ -88,7 +88,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; ), ) ) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Gateway') .addPanel( $.panel('Requests / sec') + diff --git a/operations/mimir-mixin/dashboards/ruler.libsonnet b/operations/mimir-mixin/dashboards/ruler.libsonnet index 7bf6bb292a5..383e5200443 100644 --- a/operations/mimir-mixin/dashboards/ruler.libsonnet +++ b/operations/mimir-mixin/dashboards/ruler.libsonnet @@ -103,7 +103,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; ), ) ) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Configuration API (gateway)') .addPanel( $.panel('QPS') + diff --git a/operations/mimir-mixin/dashboards/writes-networking.libsonnet b/operations/mimir-mixin/dashboards/writes-networking.libsonnet index 2deca121fa8..986c3764871 100644 --- a/operations/mimir-mixin/dashboards/writes-networking.libsonnet +++ b/operations/mimir-mixin/dashboards/writes-networking.libsonnet @@ -4,7 +4,7 @@ local utils = import 'mixin-utils/utils.libsonnet'; 'mimir-writes-networking.json': ($.dashboard('Writes networking') + { uid: '681cd62b680b7154811fe73af55dcfd4' }) .addClusterSelectorTemplates(false) - .addRow($.jobNetworkingRow('Gateway', 'gateway')) + .addRowIf($._config.gateway_enabled, $.jobNetworkingRow('Gateway', 'gateway')) .addRow($.jobNetworkingRow('Distributor', 'distributor')) .addRow($.jobNetworkingRow('Ingester', 'ingester')) + { diff --git a/operations/mimir-mixin/dashboards/writes-resources.libsonnet b/operations/mimir-mixin/dashboards/writes-resources.libsonnet index f2df3f84f96..e4f4694662e 100644 --- a/operations/mimir-mixin/dashboards/writes-resources.libsonnet +++ b/operations/mimir-mixin/dashboards/writes-resources.libsonnet @@ -4,7 +4,8 @@ local utils = import 'mixin-utils/utils.libsonnet'; 'mimir-writes-resources.json': ($.dashboard('Writes resources') + { uid: 'c0464f0d8bd026f776c9006b0591bb0b' }) .addClusterSelectorTemplates(false) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Gateway') .addPanel( $.containerCPUUsagePanel('CPU', $._config.job_names.gateway), diff --git a/operations/mimir-mixin/dashboards/writes.libsonnet b/operations/mimir-mixin/dashboards/writes.libsonnet index 9a112540cd3..8657421a13e 100644 --- a/operations/mimir-mixin/dashboards/writes.libsonnet +++ b/operations/mimir-mixin/dashboards/writes.libsonnet @@ -102,12 +102,14 @@ local utils = import 'mixin-utils/utils.libsonnet'; $.panel('Tenants') + $.statPanel('count(count by(user) (cortex_ingester_active_series{%s}))' % $.jobMatcher($._config.job_names.ingester), format='short') ) - .addPanel( + .addPanelIf( + $._config.gateway_enabled, $.panel('Requests / sec') + $.statPanel('sum(rate(cortex_request_duration_seconds_count{%s, route=~"api_(v1|prom)_push"}[5m]))' % $.jobMatcher($._config.job_names.gateway), format='reqps') ) ) - .addRow( + .addRowIf( + $._config.gateway_enabled, $.row('Gateway') .addPanel( $.panel('Requests / sec') + From dd1ad599ec1ad3a7abd1f726e4bb69a47c89a505 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Wed, 27 Apr 2022 09:28:54 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9de738bd226..27b49f08eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,7 @@ * [ENHANCEMENT] Dashboards: Show QPS and latency of the Alertmanager Distributor. #1696 * [ENHANCEMENT] Playbooks: Add Alertmanager suggestions for `MimirRequestErrors` and `MimirRequestLatency` #1702 * [ENHANCEMENT] Dashboards: Allow custom datasources. #1749 -* [ENHANCEMENT] Dashboards: Optionally drop gateway widgets. #1761 +* [ENHANCEMENT] Dashboards: Add config option `gateway_enabled` (defaults to `true`) to disable gateway panels from dashboards. #1761 * [BUGFIX] Dashboards: Fix "Failed evaluation rate" panel on Tenants dashboard. #1629 * [BUGFIX] Honor the configured `per_instance_label` in all dashboards and alerts. #1697