From 940016e00265748fba2f5f843161d726fe9823af Mon Sep 17 00:00:00 2001 From: Linas Medziunas Date: Thu, 23 Jan 2025 08:49:47 +0200 Subject: [PATCH] promql: use histogram stats decoder for histogram_avg Signed-off-by: Linas Medziunas --- promql/engine.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/promql/engine.go b/promql/engine.go index bbd841026..4e765c434 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -3721,14 +3721,15 @@ func detectHistogramStatsDecoding(expr parser.Expr) { if !ok { continue } - if call.Func.Name == "histogram_count" || call.Func.Name == "histogram_sum" { + switch call.Func.Name { + case "histogram_count", "histogram_sum", "histogram_avg": n.SkipHistogramBuckets = true - break - } - if call.Func.Name == "histogram_quantile" || call.Func.Name == "histogram_fraction" { + case "histogram_quantile", "histogram_fraction": n.SkipHistogramBuckets = false - break + default: + continue } + break } return errors.New("stop") })