feat: all-five-sketch query_statistic + cold-store wiring (P1) - #69
Merged
Merged
Conversation
Lands the backend half of the runtime e2e: each sketch type now has
a verified PromQL → backend path through the modified-OTLP wire
format (typed Metric.data = {DDSketch | KLLSketch | HLLSketch |
CountSketch | CountMinSketch}).
query_statistic implementations:
- DDSketchAccumulator: Quantile / Sum / Count / Min / Max.
- HllSketchAccumulator: Cardinality, with Count accepted as a
Cardinality alias for the existing PromQL count(...) path.
- CountSketchAccumulator: Topk / Count / Sum, no-key fallback
returns row-mean total.
- CountMinSketchAccumulator: Count / Sum, no-key fallback returns
the min-row sum — canonical CMS total-event estimator that's
exact when each insert increments one cell per row (and CMS
never under-counts).
accumulator_factory.rs: DDSketchAccumulatorUpdater wired in
alongside CMS / CountSketch / KLL / HLL updaters so the
precompute_engine recognises AggregationType::DDSketch from
streaming.yaml.
Modified-OTLP envelope decoders go through
from_sketchlib_proto_bytes / from_msgpack_bytes against
SketchEnvelope { sketch_state: Some(SketchState::*(state)) }.
P1 — cold-store flag wiring (asap-query-engine/main.rs):
- --cold-store-root with env = "ASAP_COLD_STORE_ROOT" plumbed
through a build_adapter_config helper that selects
prometheus_promql_with_cold when set.
- Combine with --forward-unsupported-queries to keep Prom as the
tail of the chain.
- Four unit tests pin the wiring matrix (cold × forward).
Companion PR in ASAPCollector lands the agent + harness
(see ProjectASAP/ASAPCollector#204).
Known cleanup (not a blocker): compatible_agg_types in
capability_matching.rs doesn't list CountMinSketch under
Statistic::Sum, but query_logics treats CMS as the canonical
approximator for both Sum and Count. The exact-match
find_query_config path bypasses capability matching, so the
runtime e2e succeeds today; reconciling the two tables is a
separate change.
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
Backend half of the runtime e2e: each sketch type now has a verified PromQL → backend path through the modified-OTLP wire format (typed
Metric.data = {DDSketch | KLLSketch | HLLSketch | CountSketch | CountMinSketch}). Companion PR in ASAPCollector (#204) lands the agent + harness.query_statisticimplementationsDDSketchAccumulatorHllSketchAccumulatorcount(...)path land on HLLCountSketchAccumulatorCountMinSketchAccumulatorFactory wiring
accumulator_factory.rs:DDSketchAccumulatorUpdaterwired in alongside CMS / CountSketch / KLL / HLL updaters so the precompute_engine recognisesAggregationType::DDSketchfromstreaming.yaml.Modified-OTLP envelope decoders go through
from_sketchlib_proto_bytes/from_msgpack_bytesagainstSketchEnvelope { sketch_state: Some(SketchState::*(state)) }.P1 — cold-store flag
asap-query-engine/src/main.rs:--cold-store-rootwithenv = "ASAP_COLD_STORE_ROOT"plumbed through abuild_adapter_confighelper that selectsprometheus_promql_with_coldwhen set.--forward-unsupported-queriesto keep Prom as the tail of the chain; without it, unsupported shapes return empty.This unblocks the three-way harness (#66) reporting the cold-tier accuracy figure end-to-end, and the cold path is what carries the e2e flow today (warm-tier sketch ingest is dropped at the OTel gateway — see ASAPCollector#204 follow-ups).
Known cleanup (not a blocker)
compatible_agg_typesincapability_matching.rsdoesn't listCountMinSketchunderStatistic::Sum, butquery_logicstreats CMS as the canonical approximator for bothSumandCount. The exact-matchfind_query_configpath bypasses capability matching, so the runtime e2e succeeds today; reconciling the two tables is a separate change.Test plan
cargo build/cargo checkcleanhistogram_quantile(0.5/0.9/0.99,…)→ 21.12 / 47.95 / 104.60 within ε=0.01 (relative_quantile)histogram_quantile(0.5,…)→ 18.26 within ε=0.16 (rank_quantile)count(http_requests_total)→ 149.68 within ε=0.008 (relative_cardinality)sum_over_time(http_requests_total[1m])→ 24266 within ε=0.03 (additive_frequency)sum_over_time(http_requests_total[1m])→ 145735 within ε≈0.0027, δ=0.03125🤖 Generated with Claude Code