Skip to content

Commit

Permalink
tempo-mixin: clear allValue so selecting All namespaces only queries …
Browse files Browse the repository at this point in the history
…Tempo namespaces

This is a temporary patch until grafana/jsonnet-libs#703 is merged.
More details can be found in that issue as well.
  • Loading branch information
Koenraad Verheyden committed Nov 26, 2021
1 parent a1a95b3 commit 7c5c869
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
8 changes: 4 additions & 4 deletions operations/tempo-mixin/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.PHONY: all check install dashboards alerts rules

all: dashboards alerts rules
all: install dashboards alerts rules

check: all
git diff --exit-code -- yamls/

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
35 changes: 33 additions & 2 deletions operations/tempo-mixin/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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)::
Expand Down Expand Up @@ -137,4 +168,4 @@ grafana {
$.queryPanel('sum by(instance) (go_memstats_heap_inuse_bytes{%s})' % job, '{{instance}}') +
{ yaxes: $.yaxes('bytes') },

}
}
2 changes: 1 addition & 1 deletion operations/tempo-mixin/yamls/tempo-reads.json
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@
"useTags": false
},
{
"allValue": ".+",
"allValue": null,
"current": {
"selected": true,
"text": "All",
Expand Down
2 changes: 1 addition & 1 deletion operations/tempo-mixin/yamls/tempo-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@
"useTags": false
},
{
"allValue": ".+",
"allValue": null,
"current": {
"selected": true,
"text": "All",
Expand Down
2 changes: 1 addition & 1 deletion operations/tempo-mixin/yamls/tempo-writes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@
"useTags": false
},
{
"allValue": ".+",
"allValue": null,
"current": {
"selected": true,
"text": "All",
Expand Down

0 comments on commit 7c5c869

Please sign in to comment.