Skip to content

fix(control-plane): derive lookback from PromQL - #722

Merged
zzylol merged 4 commits into
mainfrom
706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug
Sep 14, 2026
Merged

zzylol merged 4 commits into
mainfrom
706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug

Conversation

@milindsrivastava1997

@milindsrivastava1997 milindsrivastava1997 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Why

A snapshot's manual time_selection.lookback can disagree with PromQL, causing planning and readout to use the wrong history (#706).

Changes

Derive each query's history from its PromQL tree, including range selectors, subqueries, positive offsets, and every branch of joins, binary operations, and concatenations. Apply required implementation.scrape_interval_ms to each rangeless source before adding enclosing history. Explicit range selectors retain their own materialization windows.

Reject non-null manual snapshot lookback and fractional-second ranges/offsets that the seconds-based backend cannot represent. Migrate discovery output to the new schema and observed scrape cadence, preserve snapshot roundtrips, and add compiler and discovery-to-planner regressions. Resolve conflicts with main while preserving the Min/Max split and current-series execution.

The scrape-cadence default is the backend-local planning contract. It is distinct from Prometheus's instant-selector lookback delta. Current-series execution retains its independent five-minute selector lookback and receives the declared scrape cadence for its input-lag limit. The measured window cost model is preserved; HTTP query_range behavior remains tracked separately in #720.

Before this PR

A 5-minute selector could be planned with a conflicting 1-minute manual lookback. Rangeless queries had no automatic cadence default.

After this PR

A 5-minute selector derives 300 seconds automatically. With a 5-second scrape cadence, sum(a offset 1h) derives 3605 seconds, and a mixed expression containing a 1-second range and a rangeless source retains a 5-second horizon. Histogram concatenations preserve their range requirements. Discovery-generated snapshots deserialize and plan without supplying manual lookback.

Verification

@milindsrivastava1997 milindsrivastava1997 changed the title Derive backend-local windows from PromQL fix(control-plane): derive lookback from PromQL Sep 13, 2026
@milindsrivastava1997
milindsrivastava1997 marked this pull request as ready for review September 13, 2026 23:42
@milindsrivastava1997
milindsrivastava1997 force-pushed the 706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug branch from 090b81f to fe21bce Compare September 13, 2026 23:45
@milindsrivastava1997
milindsrivastava1997 marked this pull request as draft September 13, 2026 23:46
@milindsrivastava1997
milindsrivastava1997 marked this pull request as ready for review September 13, 2026 23:46
@zzylol
zzylol merged commit b06385d into main Sep 14, 2026
1 check passed
@zzylol
zzylol deleted the 706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug branch September 14, 2026 20:34
@zzylol
zzylol restored the 706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug branch September 14, 2026 20:34
@zzylol
zzylol deleted the 706-lookback-vs-promql-range-selector-redundant-window-concepts-+-query_range-readout-bug branch September 14, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lookback vs PromQL range selector: redundant window concepts (+ /query_range readout bug)

2 participants