diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index aacfa2bfb..e89c0ddbb 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -343,12 +343,24 @@ func vmrangeBucketsToLE(tss []*timeseries) []*timeseries { ts.MetricName.AddTag("le", leStr) return &ts } + isZeroTS := func(ts *timeseries) bool { + for _, v := range ts.Values { + if v > 0 { + return false + } + } + return true + } for _, xss := range m { sort.Slice(xss, func(i, j int) bool { return xss[i].end < xss[j].end }) xssNew := make([]x, 0, len(xss)+2) var xsPrev x for _, xs := range xss { ts := xs.ts + if isZeroTS(ts) { + // Skip time series with zeros. They are substituted by xssNew below. + continue + } if xs.start != xsPrev.end { xssNew = append(xssNew, x{ endStr: xs.startStr,