diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index 6bb8921b0..6d2b44866 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -699,6 +699,9 @@ func QueryHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseWr start -= offset end := start start = end - window + if start < 0 { + start = 0 + } // Do not include data point with a timestamp matching the lower boundary of the window as Prometheus does. start++ if end < start { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b5fa32d46..5201d52bd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,8 @@ The following `tip` changes can be tested by building VictoriaMetrics components ## v1.93.x long-time support release (LTS) +* BUGFIX: [vmselect](https://docs.victoriametrics.com/vmselect.html): properly determine time range search for instant queries with too big look-behind window like `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. + ## [v1.93.10](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.10) Released at 2024-01-17