mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
app/vmselect/promql: do not return 0
value from sum_over_time(m[d])
when there are no samples on the given d
window.
This aligns the behaviour of `sum_over_time()` with other `_over_time()` functions and with Prometheus behavior.
This commit is contained in:
parent
490c70a958
commit
def513355e
@ -1142,10 +1142,10 @@ func rollupSum(rfa *rollupFuncArg) float64 {
|
|||||||
// before calling rollup funcs.
|
// before calling rollup funcs.
|
||||||
values := rfa.values
|
values := rfa.values
|
||||||
if len(values) == 0 {
|
if len(values) == 0 {
|
||||||
if math.IsNaN(rfa.prevValue) {
|
// Do not take into account rfa.prevValue, since it may lead
|
||||||
return nan
|
// to inconsistent results comparing to Prometheus on broken time series
|
||||||
}
|
// with irregular data points.
|
||||||
return 0
|
return nan
|
||||||
}
|
}
|
||||||
var sum float64
|
var sum float64
|
||||||
for _, v := range values {
|
for _, v := range values {
|
||||||
|
Loading…
Reference in New Issue
Block a user