mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect: return NaN instead of 0 for empty value sets (#1660)
The change affects `count/stddev/stdvar_over_time` funcs and makes them to return NaN instead of zero when there is no datapoints in a time window. This is needed for improving compatibility with Prometheus. Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
03cd93bf1a
commit
dd536b475c
1 changed files with 2 additions and 8 deletions
|
@ -1352,10 +1352,7 @@ func rollupCount(rfa *rollupFuncArg) float64 {
|
|||
// before calling rollup funcs.
|
||||
values := rfa.values
|
||||
if len(values) == 0 {
|
||||
if math.IsNaN(rfa.prevValue) {
|
||||
return nan
|
||||
}
|
||||
return 0
|
||||
return nan
|
||||
}
|
||||
return float64(len(values))
|
||||
}
|
||||
|
@ -1372,10 +1369,7 @@ func rollupStdvar(rfa *rollupFuncArg) float64 {
|
|||
// before calling rollup funcs.
|
||||
values := rfa.values
|
||||
if len(values) == 0 {
|
||||
if math.IsNaN(rfa.prevValue) {
|
||||
return nan
|
||||
}
|
||||
return 0
|
||||
return nan
|
||||
}
|
||||
if len(values) == 1 {
|
||||
// Fast path.
|
||||
|
|
Loading…
Reference in a new issue