Skip to content

Commit

Permalink
utils: fix how we hide/show native histogram queries (#1362)
Browse files Browse the repository at this point in the history
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 <gyorgy.krajcsovits@grafana.com>
  • Loading branch information
krajorama authored Dec 3, 2024
1 parent 57b0b85 commit deb2c73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mixin-utils/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit deb2c73

Please sign in to comment.