-
Notifications
You must be signed in to change notification settings - Fork 0
Derive query accuracy (Exact vs Approximate) to activate the Exact→archive routing gate #348
Copy link
Copy link
Closed
Labels
area: data planeRuntime ingestion, storage, and query-serving data pathsRuntime ingestion, storage, and query-serving data pathsarea: query enginePromQL lowering, execution, result shaping, and fallback behaviorPromQL lowering, execution, result shaping, and fallback behaviorenhancementNew feature or requestNew feature or requestfeature: PromQLPromQL compatibility and execution semanticsPromQL compatibility and execution semanticsfeature: warm summariesASAP warm-tier materialization, readiness, and servingASAP warm-tier materialization, readiness, and servingquality: accuracyExact and approximate accuracy contracts, error bounds, and routingExact and approximate accuracy contracts, error bounds, and routing
Description
Activity
Metadata
Metadata
Assignees
Labels
area: data planeRuntime ingestion, storage, and query-serving data pathsRuntime ingestion, storage, and query-serving data pathsarea: query enginePromQL lowering, execution, result shaping, and fallback behaviorPromQL lowering, execution, result shaping, and fallback behaviorenhancementNew feature or requestNew feature or requestfeature: PromQLPromQL compatibility and execution semanticsPromQL compatibility and execution semanticsfeature: warm summariesASAP warm-tier materialization, readiness, and servingASAP warm-tier materialization, readiness, and servingquality: accuracyExact and approximate accuracy contracts, error bounds, and routingExact and approximate accuracy contracts, error bounds, and routing
Context
#347 centralized query routing in
EngineRouterand added an ASAP-first failover with an accuracy gate incompatible_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
Approximateand theExact → archivebranch only runs in tests.Current state (as of #347 / a1a2df7)
data_plane/src/drivers/query/servers/http.rs:process_via_router):let stat = Statistic::Sum; let accuracy = AccuracyTarget::Approximate;(~L1217–1218)process_range_query_request): same, with aTODO(~L1686–1691)/api/v1/query(_range).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
accuracyfrom the query request and thread it intoquery_router.execute / execute_range, replacing the hardcodedAccuracyTarget::Approximateat the two sites above. Routing logic is already complete — this is input derivation + plumbing only.Signal to choose (decision needed):
?accuracy=exactquery param orX-ASAP-Accuracy: exactheader on/api/v1/query(_range)(explicit, caller-driven)AccuracyTargetper metric (alongsideresolve_metric_storage), e.g. from the control-plane plan's accuracy SLAExactSibling stub:
stat = Statistic::Sumis also hardcoded, but the policy currently ignores it (_stat) — lower priority; address only if a future policy keys onStatistic.Verify
cargo check -p data_plane+ routing/http tests; add a test asserting anExactquery routes to the archive whileApproximatestays ASAP-first.Follow-up to #347.