app/vmselect/promql: avoid dropping inf bucket in buckets_limit

The `le="inf"` bucket must be preserved in order to maintain the maximum level of accuracy.
This commit is contained in:
Aliaksandr Valialkin 2020-07-25 16:59:29 +03:00
parent 978c1e930e
commit 43871e79c6

View file

@ -363,9 +363,11 @@ func transformBucketsLimit(tfa *transformFuncArg) ([]*timeseries, error) {
xxMinIdx = i
}
}
if xxMinIdx+1 < len(leGroup) {
leGroup[xxMinIdx+1].hits += leGroup[xxMinIdx].hits
if xxMinIdx+1 == len(leGroup) {
// Merge the `inf` bucket with the previous bucket in order to save accuracy.
xxMinIdx--
}
leGroup[xxMinIdx+1].hits += leGroup[xxMinIdx].hits
leGroup = append(leGroup[:xxMinIdx], leGroup[xxMinIdx+1:]...)
}
for _, xx := range leGroup {