diff --git a/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go index d8d78040d3..7b9df7f7c9 100644 --- a/app/vmselect/promql/eval.go +++ b/app/vmselect/promql/eval.go @@ -635,11 +635,17 @@ func evalRollupFuncWithMetricExpr(ec *EvalConfig, name string, rf rollupFunc, // Fetch the remaining part of the result. tfs := toTagFilters(me.LabelFilters) + minTimestamp := start - maxSilenceInterval + if window > ec.Step { + minTimestamp -= window + } else { + minTimestamp -= ec.Step + } sq := &storage.SearchQuery{ AccountID: ec.AuthToken.AccountID, ProjectID: ec.AuthToken.ProjectID, - MinTimestamp: start - window - maxSilenceInterval, - MaxTimestamp: ec.End + ec.Step, + MinTimestamp: minTimestamp, + MaxTimestamp: ec.End, TagFilterss: [][]storage.TagFilter{tfs}, } rss, isPartial, err := netstorage.ProcessSearchQuery(ec.AuthToken, sq, true, ec.Deadline) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index ca9a988ec4..e1a3e0cfd5 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -407,7 +407,7 @@ func (tsm *timeseriesMap) GetOrCreateTimeseries(labelValue string) *timeseries { // // rc.Timestamps are used as timestamps for dstValues. // -// timestamps must cover time range [rc.Start - rc.Window - maxSilenceInterval ... rc.End + rc.Step]. +// timestamps must cover time range [rc.Start - rc.Window - maxSilenceInterval ... rc.End]. // // Do cannot be called from concurrent goroutines. func (rc *rollupConfig) Do(dstValues []float64, values []float64, timestamps []int64) []float64 {