From 7c5c869857d84b89be9ef4d00613372a73340b91 Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Fri, 26 Nov 2021 16:16:06 +0100 Subject: [PATCH 1/2] 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", From 5ec47a6249d5e69fe8484b8a302803252371f302 Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Fri, 26 Nov 2021 18:07:03 +0100 Subject: [PATCH 2/2] Run jb update, remove temporary code --- .../tempo-mixin/dashboard-utils.libsonnet | 31 ------------------- operations/tempo-mixin/jsonnetfile.lock.json | 6 ++-- .../grafana-builder/grafana.libsonnet | 8 ++--- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/operations/tempo-mixin/dashboard-utils.libsonnet b/operations/tempo-mixin/dashboard-utils.libsonnet index d48f68bc0de..a67b31ed527 100644 --- a/operations/tempo-mixin/dashboard-utils.libsonnet +++ b/operations/tempo-mixin/dashboard-utils.libsonnet @@ -7,37 +7,6 @@ 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'], diff --git a/operations/tempo-mixin/jsonnetfile.lock.json b/operations/tempo-mixin/jsonnetfile.lock.json index 55bdaa458e6..ac9ea626d82 100644 --- a/operations/tempo-mixin/jsonnetfile.lock.json +++ b/operations/tempo-mixin/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "grafana-builder" } }, - "version": "c4975f7c4a7ab4c21020c4afbf247aa49142174d", - "sum": "y8uA/daOROErelzoo2p1rtqABhUPArg2alsfcb0PQBk=" + "version": "84900d9dc450116ad66864f48088f92ccae36c54", + "sum": "0KkygBQd/AFzUvVzezE4qF/uDYgrwUXVpZfINBti0oc=" }, { "source": { @@ -18,7 +18,7 @@ "subdir": "mixin-utils" } }, - "version": "c4975f7c4a7ab4c21020c4afbf247aa49142174d", + "version": "84900d9dc450116ad66864f48088f92ccae36c54", "sum": "v6fuqqQp9rHZbsxN9o79QzOpUlwYZEJ84DxTCZMCYeU=" } ], diff --git a/operations/tempo-mixin/vendor/github.com/grafana/jsonnet-libs/grafana-builder/grafana.libsonnet b/operations/tempo-mixin/vendor/github.com/grafana/jsonnet-libs/grafana-builder/grafana.libsonnet index cae0f19f957..c98e2b36061 100644 --- a/operations/tempo-mixin/vendor/github.com/grafana/jsonnet-libs/grafana-builder/grafana.libsonnet +++ b/operations/tempo-mixin/vendor/github.com/grafana/jsonnet-libs/grafana-builder/grafana.libsonnet @@ -13,10 +13,10 @@ rows+: [row { panels: panels }], }, - addTemplate(name, metric_name, label_name, hide=0):: self { + addTemplate(name, metric_name, label_name, hide=0, allValue=null):: self { templating+: { list+: [{ - allValue: null, + allValue: allValue, current: { text: 'prod', value: 'prod', @@ -41,10 +41,10 @@ }, }, - addMultiTemplate(name, metric_name, label_name, hide=0):: self { + addMultiTemplate(name, metric_name, label_name, hide=0, allValue='.+'):: self { templating+: { list+: [{ - allValue: '.+', + allValue: allValue, current: { selected: true, text: 'All',