properly handle Histogram.Update(1e-9)
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1096
This commit is contained in:
parent
16e4558792
commit
57c9db1bc3
@ -94,7 +94,7 @@ func (h *Histogram) Update(v float64) {
|
||||
h.upper++
|
||||
} else {
|
||||
idx := uint(bucketIdx)
|
||||
if bucketIdx == float64(idx) {
|
||||
if bucketIdx == float64(idx) && idx > 0 {
|
||||
// Edge case for 10^n values, which must go to the lower bucket
|
||||
// according to Prometheus logic for `le`-based histograms.
|
||||
idx--
|
||||
|
@ -97,6 +97,8 @@ prefix_count 120
|
||||
h.Update(math.Inf(-1))
|
||||
h.Update(math.NaN())
|
||||
h.Update(-123)
|
||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1096
|
||||
h.Update(math.Float64frombits(0x3e112e0be826d695))
|
||||
|
||||
// Make sure the histogram becomes visible in the output of WritePrometheus,
|
||||
// since now it contains values.
|
||||
|
Loading…
Reference in New Issue
Block a user