fix(nhcb): inconsistent compact number

Should always use 0 to avoid accounting unused buckets. One point of
nhcb is to not store empty buckets.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2025-01-23 13:47:55 +01:00
parent 665d1ba0cc
commit bcb1213010
2 changed files with 3 additions and 3 deletions

View file

@ -500,8 +500,8 @@ something_bucket{a="b",le="+Inf"} 9 # {id="something-test"} 2e100 123.000
Schema: histogram.CustomBucketsSchema,
Count: 9,
Sum: 42123.0,
PositiveSpans: []histogram.Span{{Offset: 0, Length: 3}},
PositiveBuckets: []int64{8, -8, 1},
PositiveSpans: []histogram.Span{{Offset: 0, Length: 1}, {Offset: 1, Length: 1}},
PositiveBuckets: []int64{8, -7},
CustomValues: []float64{0.0, 1.0}, // We do not store the +Inf boundary.
},
lset: labels.FromStrings("__name__", "something", "a", "b"),

View file

@ -196,7 +196,7 @@ func (h TempHistogram) convertToIntegerHistogram(count uint64) (*histogram.Histo
return nil, nil, h.err
}
return rh.Compact(2), nil, nil
return rh.Compact(0), nil, nil
}
func (h TempHistogram) convertToFloatHistogram() (*histogram.Histogram, *histogram.FloatHistogram, error) {