app/vmselect/prometheus: remove stale NaN for range vector query

This commit is contained in:
hao.peng 2024-10-15 11:36:15 +08:00 committed by viperstars
parent 2ac07aa813
commit 9ea5ceffdb

View file

@ -22,6 +22,7 @@ import (
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/searchutils" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/searchutils"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/bufferedwriter" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bufferedwriter"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/decimal"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/encoding" "github.com/VictoriaMetrics/VictoriaMetrics/lib/encoding"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime" "github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
@ -402,8 +403,13 @@ func exportHandler(qt *querytracer.Tracer, w http.ResponseWriter, cp *commonPara
} }
xb := exportBlockPool.Get().(*exportBlock) xb := exportBlockPool.Get().(*exportBlock)
xb.mn = &rs.MetricName xb.mn = &rs.MetricName
xb.timestamps = rs.Timestamps for i, v := range rs.Values {
xb.values = rs.Values if decimal.IsStaleNaN(v) {
continue
}
xb.values = append(xb.values, v)
xb.timestamps = append(xb.timestamps, rs.Timestamps[i])
}
if err := writeLineFunc(xb, workerID); err != nil { if err := writeLineFunc(xb, workerID); err != nil {
return err return err
} }