feat(query): warm-tier fallback for /api/v1/query_range - #267
Merged
Merged
Conversation
Closes the range-query gap I documented in PR #260's session follow-up. Per-user direction (2026-05-16): count_over_time is warm-tier-answerable by sampling; topk_over_time isn't standard PromQL anyway and falls through to the cold tier (Thanos parse- error is acceptable). Sibling of PR #253's instant-query trait-dispatch fallback. New `ASAPQueryEngine::execute_range_promql_modern(query, start_ms, end_ms, step_ms)` mirrors the analyzer + reducer dispatch from the `QueryEngine::execute(&str)` trait surface but returns Matrix per the `/api/v1/query_range` wire-format spec. Wire-up: `process_range_query_request` in `http.rs` tries `handle_range_query_promql` first (legacy path, unchanged), and on `None` calls the new modern method. If the modern path also errors, it falls through to `format_unsupported_query_response` (which the EngineRouter can route to a cold-tier fallback). Prometheus semantics note: the spec says evaluate at each `t = start, start+step, …, end`. The warm tier returns samples at native window-close granularity instead — finer than the user's step when window_size < step (more data, not less). Step-precise evaluation is a future refinement; clients that need exact step timestamps can downsample, or route step- precise queries to the cold tier. Test 10 (`controller_plan_to_range_query_count_over_time_cms`) ingests heap-less CMS DPs via the same setup as Test 7, then queries `count_over_time(endpoint_request_freq[10s])` via `/api/v1/query_range`. Asserts `status=success`, `resultType=matrix`, non-empty series. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the range-query gap I documented earlier in this session. Per user direction:
count_over_timeis warm-tier-answerable by sampling;topk_over_timeisn't standard PromQL anyway and falls through to the cold tier (Thanos parse-error is acceptable).Sibling of PR #253's instant-query trait-dispatch fallback.
What changed
ASAPQueryEngine::execute_range_promql_modern(query, start_ms, end_ms, step_ms)— mirrors the analyzer + reducer dispatch fromQueryEngine::execute(&str), but returns Matrix per the/api/v1/query_rangewire-format spec.process_range_query_requestinhttp.rs— tries the legacyhandle_range_query_promqlfirst (unchanged), and onNonecalls the new modern method. Modern errors fall through toformat_unsupported_query_response(which the EngineRouter can route to a cold-tier fallback if configured).Prometheus semantics
The spec says evaluate at each
t = start, start+step, …, end. The warm tier returns samples at native window-close granularity instead — finer than the user's step when window_size < step (more data, not less). Step-precise evaluation is a future refinement; clients that need exact step timestamps can downsample, or route step-precise queries to the cold tier. Thestep_msparameter is accepted for API compatibility but currently unused; documented inline.Test plan
controller_plan_to_range_query_count_over_time_cms) ingests heap-less CMS DPs via the same setup as Test 7, then queriescount_over_time(endpoint_request_freq[10s])via/api/v1/query_range. Assertsstatus=success,resultType=matrix, non-empty series.cargo test --workspace --lib— 1533 pass, 0 fail🤖 Generated with Claude Code