Repository navigation
Description
Context
#347 centralized query routing in EngineRouter and added an ASAP-first failover with an accuracy gate in compatible_storage_backends (crates/asap_types/src/capability_matching.rs):
Exact→[GorillaObjectStore](archive only — warm sketches are ε/δ-bounded)Approximate→[SketchStore, GorillaObjectStore](ASAP-first, archive fallback)
The gate is correct but dormant — both live query paths hardcode the input, so every real query is treated as Approximate and the Exact → archive branch only runs in tests.
Current state (as of #347 / a1a2df7)
data_plane/src/drivers/query/servers/http.rs:- instant (
process_via_router):let stat = Statistic::Sum; let accuracy = AccuracyTarget::Approximate;(~L1217–1218) - range (
process_range_query_request): same, with aTODO(~L1686–1691) - stub acknowledged in the comment ~L1172–1180
- instant (
- The only place accuracy is read from input today is the precompute-job POST body (~L3411), not
/api/v1/query(_range). - The ASAP engine's analyzer (
analyze_promql_for_asap_tier) keys on query shape only, not accuracy — so "exact must use the archive" can only be enforced at the router, with a real accuracy input.
Why it matters
Until this lands, a query that needs exact values is silently answered from the ε/δ-bounded sketch tier (an approximate result presented as exact), with no way for the caller to demand the archive.
Task
Derive accuracy from the query request and thread it into query_router.execute / execute_range, replacing the hardcoded AccuracyTarget::Approximate at the two sites above. Routing logic is already complete — this is input derivation + plumbing only.
Signal to choose (decision needed):
- HTTP signal —
?accuracy=exactquery param orX-ASAP-Accuracy: exactheader on/api/v1/query(_range)(explicit, caller-driven) - Per-metric / plan config — resolve an
AccuracyTargetper metric (alongsideresolve_metric_storage), e.g. from the control-plane plan's accuracy SLA - PromQL-shape derivation — map shapes that can't tolerate approximation to
Exact
Sibling stub: stat = Statistic::Sum is also hardcoded, but the policy currently ignores it (_stat) — lower priority; address only if a future policy keys on Statistic.
Verify
cargo check -p data_plane + routing/http tests; add a test asserting an Exact query routes to the archive while Approximate stays ASAP-first.
Follow-up to #347.
Activity
zzylol commentedon Sep 4, 2026
Fix is now open in #507. It adds the explicit
X-ASAP-Accuracy: exact|approximatecontract for both instant and range endpoints, routes exact requests archive-only even from a SketchStore-configured metric, rejects invalid hints, and reports the actual answering engine. Four focused tests pass. Leaving this issue open until the PR is merged, per the requested workflow.