Skip to content

planner/optimizer: set range_a_secs to scrape_interval for spatial-only queries instead of None #421

Description

@milindsrivastava1997

planner/optimizer — for spatial-only queries (no PromQL range-vector selector, e.g. sum(metric) by (label)), aqe_extractor.rs::extract_requirements (around line 209-214) sets QueryRequirements.data_range_ms to None, since there's no [...] duration to read.

Downstream, candidate_gen.rs::window_candidates (around line 106-113) already treats a None range as equivalent to a single tumbling window of scrape_interval_secs — so the behavior already matches "spatial query has range = scrape interval," it's just implicit in a different file than where the field is set.

Proposal: set data_range_ms explicitly to Some(scrape_interval) for spatial-only queries at the point it's computed in aqe_extractor.rs, instead of None + an implicit fallback elsewhere. This makes the semantics explicit at the source.

Before making this change: data_range_ms lives on QueryRequirements (asap_types), which is shared with asap-query-engine. Need to check whether any other consumer pattern-matches on data_range_ms == None specifically to mean "no range vector" (distinct from "range vector with duration == scrape_interval") before changing what None means for spatial-only queries.

Found during code review of PR #407.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions