From 7c5c869857d84b89be9ef4d00613372a73340b91 Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Fri, 26 Nov 2021 16:16:06 +0100 Subject: [PATCH] tempo-mixin: clear allValue so selecting All namespaces only queries Tempo namespaces This is a temporary patch until https://github.com/grafana/jsonnet-libs/pull/703 is merged. More details can be found in that issue as well. --- operations/tempo-mixin/Makefile | 8 ++--- .../tempo-mixin/dashboard-utils.libsonnet | 35 +++++++++++++++++-- operations/tempo-mixin/yamls/tempo-reads.json | 2 +- .../tempo-mixin/yamls/tempo-resources.json | 2 +- .../tempo-mixin/yamls/tempo-writes.json | 2 +- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/operations/tempo-mixin/Makefile b/operations/tempo-mixin/Makefile index 16471f8fb0c..4ac84166e04 100644 --- a/operations/tempo-mixin/Makefile +++ b/operations/tempo-mixin/Makefile @@ -1,6 +1,6 @@ .PHONY: all check install dashboards alerts rules -all: dashboards alerts rules +all: install dashboards alerts rules check: all git diff --exit-code -- yamls/ @@ -8,11 +8,11 @@ check: all install: jb install -dashboards: install +dashboards: jsonnet -J vendor -S dashboards.jsonnet -m yamls -alerts: install +alerts: jsonnet -J vendor -S alerts.jsonnet > yamls/alerts.yaml -rules: install +rules: jsonnet -J vendor -S rules.jsonnet > yamls/rules.yaml diff --git a/operations/tempo-mixin/dashboard-utils.libsonnet b/operations/tempo-mixin/dashboard-utils.libsonnet index e66bd87d699..d48f68bc0de 100644 --- a/operations/tempo-mixin/dashboard-utils.libsonnet +++ b/operations/tempo-mixin/dashboard-utils.libsonnet @@ -7,6 +7,37 @@ grafana { // - some links that propagate the selected cluster. dashboard(title):: super.dashboard(title) + { + // Override addMultipleTempalte to make allValue configurable + // Remove when https://github.com/grafana/jsonnet-libs/pull/703 is merged + addMultiTemplate(name, metric_name, label_name, hide=0, allValue='.+'):: self { + templating+: { + list+: [{ + allValue: allValue, + current: { + selected: true, + text: 'All', + value: '$__all', + }, + datasource: '$datasource', + hide: hide, + includeAll: true, + label: name, + multi: true, + name: name, + options: [], + query: 'label_values(%s, %s)' % [metric_name, label_name], + refresh: 1, + regex: '', + sort: 2, + tagValuesQuery: '', + tags: [], + tagsQuery: '', + type: 'query', + useTags: false, + }], + }, + }, + addClusterSelectorTemplates():: local d = self { tags: ['tempo'], @@ -25,7 +56,7 @@ grafana { }; d.addMultiTemplate('cluster', 'tempo_build_info', 'cluster') - .addMultiTemplate('namespace', 'tempo_build_info', 'namespace'), + .addMultiTemplate('namespace', 'tempo_build_info', 'namespace', allValue=null), }, jobMatcher(job):: @@ -137,4 +168,4 @@ grafana { $.queryPanel('sum by(instance) (go_memstats_heap_inuse_bytes{%s})' % job, '{{instance}}') + { yaxes: $.yaxes('bytes') }, -} \ No newline at end of file +} diff --git a/operations/tempo-mixin/yamls/tempo-reads.json b/operations/tempo-mixin/yamls/tempo-reads.json index 04feb658258..07f02956dd4 100644 --- a/operations/tempo-mixin/yamls/tempo-reads.json +++ b/operations/tempo-mixin/yamls/tempo-reads.json @@ -1623,7 +1623,7 @@ "useTags": false }, { - "allValue": ".+", + "allValue": null, "current": { "selected": true, "text": "All", diff --git a/operations/tempo-mixin/yamls/tempo-resources.json b/operations/tempo-mixin/yamls/tempo-resources.json index cc1b1784cca..bda621fed27 100644 --- a/operations/tempo-mixin/yamls/tempo-resources.json +++ b/operations/tempo-mixin/yamls/tempo-resources.json @@ -1871,7 +1871,7 @@ "useTags": false }, { - "allValue": ".+", + "allValue": null, "current": { "selected": true, "text": "All", diff --git a/operations/tempo-mixin/yamls/tempo-writes.json b/operations/tempo-mixin/yamls/tempo-writes.json index 6f81d47767d..f5803c8265f 100644 --- a/operations/tempo-mixin/yamls/tempo-writes.json +++ b/operations/tempo-mixin/yamls/tempo-writes.json @@ -1673,7 +1673,7 @@ "useTags": false }, { - "allValue": ".+", + "allValue": null, "current": { "selected": true, "text": "All",