From bfbe4136f62932e1b84528aa149498e3fff6fa0e Mon Sep 17 00:00:00 2001 From: "Abdurrahman J. Allawala" Date: Fri, 15 Oct 2021 12:14:09 -0700 Subject: [PATCH 1/2] add ability to override datasource for dashboards --- cortex-mixin/config.libsonnet | 3 +++ cortex-mixin/dashboards/dashboard-utils.libsonnet | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cortex-mixin/config.libsonnet b/cortex-mixin/config.libsonnet index 9b8d81a2..ef8d1568 100644 --- a/cortex-mixin/config.libsonnet +++ b/cortex-mixin/config.libsonnet @@ -68,5 +68,8 @@ // The routes to exclude from alerts. alert_excluded_routes: [], + + // Name of the datasource for which the dashboards should attach to + dashboard_datasource: 'default', }, } diff --git a/cortex-mixin/dashboards/dashboard-utils.libsonnet b/cortex-mixin/dashboards/dashboard-utils.libsonnet index 981614ac..e4268192 100644 --- a/cortex-mixin/dashboards/dashboard-utils.libsonnet +++ b/cortex-mixin/dashboards/dashboard-utils.libsonnet @@ -8,7 +8,7 @@ local utils = import 'mixin-utils/utils.libsonnet'; // - default tags, // - some links that propagate the selectred cluster. dashboard(title):: - super.dashboard(title) + { + super.dashboard(title=title, datasource=$._config.dashboard_datasource) + { addRowIf(condition, row):: if condition then self.addRow(row) From 9eb3000d03575e77a47cf5a8187d7942394da6cd Mon Sep 17 00:00:00 2001 From: "Abdurrahman J. Allawala" Date: Fri, 15 Oct 2021 12:35:42 -0700 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 698d38c3..f0a3f589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ * [ENHANCEMENT] Add recording rules to improve responsiveness of Alertmanager dashboard. #387 * [ENHANCEMENT] Add `CortexRolloutStuck` alert. #405 * [ENHANCEMENT] Added `CortexKVStoreFailure` alert. #406 +* [ENHANCEMENT] Add ability to override `datasource` for generated dashboards. #407 * [BUGFIX] Fixed `CortexIngesterHasNotShippedBlocks` alert false positive in case an ingester instance had ingested samples in the past, then no traffic was received for a long period and then it started receiving samples again. #308 * [BUGFIX] Alertmanager: fixed `--alertmanager.cluster.peers` CLI flag passed to alertmanager when HA is enabled. #329 * [BUGFIX] Fixed `CortexInconsistentRuntimeConfig` metric. #335