Skip to content

Commit deb2c73

Browse files
authored
utils: fix how we hide/show native histogram queries (#1362)
Due to prometheus/prometheus#15245 the previous trick doesn't work for us to exclude/include all results from a PromQL query. Signed-off-by: György Krajcsovits <[email protected]>
1 parent 57b0b85 commit deb2c73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mixin-utils/utils.libsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ local g = import 'grafana-builder/grafana.libsonnet';
180180

181181
// showClassicHistogramQuery wraps a query defined as map {classic: q, native: q}, and compares the classic query
182182
// to dashboard variable which should take -1 or +1 as values in order to hide or show the classic query.
183-
showClassicHistogramQuery(query, dashboard_variable='latency_metrics'):: '%s < ($%s * +Inf)' % [query.classic, dashboard_variable],
183+
showClassicHistogramQuery(query, dashboard_variable='latency_metrics'):: '(%s) and on() (vector($%s) == 1)' % [query.classic, dashboard_variable],
184184
// showNativeHistogramQuery wraps a query defined as map {classic: q, native: q}, and compares the native query
185185
// to dashboard variable which should take -1 or +1 as values in order to show or hide the native query.
186-
showNativeHistogramQuery(query, dashboard_variable='latency_metrics'):: '%s < ($%s * -Inf)' % [query.native, dashboard_variable],
186+
showNativeHistogramQuery(query, dashboard_variable='latency_metrics'):: '(%s) and on() (vector($%s) == -1)' % [query.native, dashboard_variable],
187187

188188
histogramRules(metric, labels, interval='1m', record_native=false)::
189189
local vars = {

0 commit comments

Comments
 (0)