From a1eea90d61433d5c0f03fe6474ed3d87162903da Mon Sep 17 00:00:00 2001 From: Gabriel Antunes Date: Mon, 27 May 2024 18:52:39 -0300 Subject: [PATCH] Allow config overwrite, and make grafanaDashboards and prometheusAlerts hidden --- operations/alloy-mixin/alerts.libsonnet | 2 +- operations/alloy-mixin/dashboards.libsonnet | 28 +++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/operations/alloy-mixin/alerts.libsonnet b/operations/alloy-mixin/alerts.libsonnet index 548e41febd..ab23492080 100644 --- a/operations/alloy-mixin/alerts.libsonnet +++ b/operations/alloy-mixin/alerts.libsonnet @@ -10,7 +10,7 @@ local openTelemetryAlerts = (import './alerts/opentelemetry.libsonnet'); openTelemetryAlerts.newOpenTelemetryAlertsGroup($._config.enableK8sCluster) ], - prometheusAlerts+: { + prometheusAlerts+:: { groups+: if $._config.enableAlloyCluster then alloyClusterAlerts + otherAlerts diff --git a/operations/alloy-mixin/dashboards.libsonnet b/operations/alloy-mixin/dashboards.libsonnet index 281c48c765..c6330c4769 100644 --- a/operations/alloy-mixin/dashboards.libsonnet +++ b/operations/alloy-mixin/dashboards.libsonnet @@ -1,18 +1,20 @@ -local alloyClusterDashboards = - (import './dashboards/cluster-node.libsonnet') + - (import './dashboards/cluster-overview.libsonnet') + - (import './config.libsonnet'); +(import './dashboards/alloy-logs.libsonnet') + +{ + local alloyClusterDashboards = + (import './dashboards/cluster-node.libsonnet') + + (import './dashboards/cluster-overview.libsonnet') + + config, -local otherDashboards = - (import './dashboards/resources.libsonnet') + - (import './dashboards/controller.libsonnet') + - (import './dashboards/prometheus.libsonnet') + - (import './dashboards/opentelemetry.libsonnet') + - (import './config.libsonnet'); + local otherDashboards = + (import './dashboards/resources.libsonnet') + + (import './dashboards/controller.libsonnet') + + (import './dashboards/prometheus.libsonnet') + + (import './dashboards/opentelemetry.libsonnet') + + config, -(import './dashboards/alloy-logs.libsonnet') + -{ - grafanaDashboards+: + local config = {_config:: $._config}, + + grafanaDashboards+:: if $._config.enableAlloyCluster then alloyClusterDashboards + otherDashboards