mirror of
https://github.com/prometheus/prometheus.git
synced 2026-03-06 14:11:46 +01:00
promql: Fix avg_over_time for single histogram
avg_over_time would produce +Inf count/sum and NaN zero bucket when averaging a single histogram, because the count variable was initialized to 0 instead of 1. This caused a division by zero at the end of the function. The float version of avg_over_time already correctly initializes count to 1, this change makes the histogram version consistent with that. Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
9fddb70b8c
commit
d2bb5605dc
@ -848,7 +848,7 @@ func funcAvgOverTime(_ []Vector, matrixVal Matrix, args parser.Expressions, enh
|
||||
var (
|
||||
sum = s.Histograms[0].H.Copy()
|
||||
mean, kahanC *histogram.FloatHistogram
|
||||
count float64
|
||||
count = 1.
|
||||
incrementalMean bool
|
||||
nhcbBoundsReconciled bool
|
||||
err error
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user