mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
app/vmselect/promql: return NaN from histogram_quantile if at least a single bucket is broken
This commit is contained in:
parent
4aaa5c2efc
commit
8bd6f1f6df
1 changed files with 8 additions and 8 deletions
|
@ -324,6 +324,14 @@ func transformHistogramQuantile(tfa *transformFuncArg) ([]*timeseries, error) {
|
||||||
if math.IsNaN(phi) {
|
if math.IsNaN(phi) {
|
||||||
return nan
|
return nan
|
||||||
}
|
}
|
||||||
|
// Verify for broken buckets with NaN or negative values.
|
||||||
|
for _, xs := range xss {
|
||||||
|
v := xs.ts.Values[i]
|
||||||
|
if math.IsNaN(v) || v < 0 {
|
||||||
|
// Broken bucket.
|
||||||
|
return nan
|
||||||
|
}
|
||||||
|
}
|
||||||
if phi < 0 {
|
if phi < 0 {
|
||||||
return -inf
|
return -inf
|
||||||
}
|
}
|
||||||
|
@ -331,16 +339,8 @@ func transformHistogramQuantile(tfa *transformFuncArg) ([]*timeseries, error) {
|
||||||
return inf
|
return inf
|
||||||
}
|
}
|
||||||
vReq := xss[len(xss)-1].ts.Values[i] * phi
|
vReq := xss[len(xss)-1].ts.Values[i] * phi
|
||||||
if math.IsNaN(vReq) || vReq < 0 {
|
|
||||||
// Broken bucket.
|
|
||||||
return nan
|
|
||||||
}
|
|
||||||
for _, xs := range xss {
|
for _, xs := range xss {
|
||||||
v := xs.ts.Values[i]
|
v := xs.ts.Values[i]
|
||||||
if math.IsNaN(v) || v < 0 {
|
|
||||||
// Broken bucket.
|
|
||||||
return nan
|
|
||||||
}
|
|
||||||
le := xs.le
|
le := xs.le
|
||||||
if v < vReq {
|
if v < vReq {
|
||||||
vPrev = v
|
vPrev = v
|
||||||
|
|
Loading…
Reference in a new issue