From cf51a629aa4d1dd816d489931580148733346ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Mon, 25 Nov 2024 11:04:55 +0100 Subject: [PATCH] utils: fix how we hide/show native histogram queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to https://github.com/prometheus/prometheus/pull/15245 the previous trick doesn't work for us to exclude/include all results from a PromQL query. Signed-off-by: György Krajcsovits --- mixin-utils/utils.libsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mixin-utils/utils.libsonnet b/mixin-utils/utils.libsonnet index f80fc681e..7eabb5f0f 100644 --- a/mixin-utils/utils.libsonnet +++ b/mixin-utils/utils.libsonnet @@ -180,10 +180,10 @@ local g = import 'grafana-builder/grafana.libsonnet'; // showClassicHistogramQuery wraps a query defined as map {classic: q, native: q}, and compares the classic query // to dashboard variable which should take -1 or +1 as values in order to hide or show the classic query. - showClassicHistogramQuery(query, dashboard_variable='latency_metrics'):: '%s < ($%s * +Inf)' % [query.classic, dashboard_variable], + showClassicHistogramQuery(query, dashboard_variable='latency_metrics'):: '(%s) and on() (vector($%s) == 1)' % [query.classic, dashboard_variable], // showNativeHistogramQuery wraps a query defined as map {classic: q, native: q}, and compares the native query // to dashboard variable which should take -1 or +1 as values in order to show or hide the native query. - showNativeHistogramQuery(query, dashboard_variable='latency_metrics'):: '%s < ($%s * -Inf)' % [query.native, dashboard_variable], + showNativeHistogramQuery(query, dashboard_variable='latency_metrics'):: '(%s) and on() (vector($%s) == -1)' % [query.native, dashboard_variable], histogramRules(metric, labels, interval='1m', record_native=false):: local vars = {