Skip to content

eval(inference): expand warm-tier PromQL pattern coverage - #79

Merged
zzylol merged 1 commit into
mainfrom
eval/inference-config-expand-query-patterns
May 5, 2026
Merged

zzylol merged 1 commit into
mainfrom
eval/inference-config-expand-query-patterns

Conversation

@zzylol

@zzylol zzylol commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expands asap-query-engine/examples/promql/inference_config.yaml (and the SQL twin) from a single entry per metric to cover multi-quantile, wider ranges, rate / increase, sum / count over time, spatial aggregations, and top-K. Each entry binds a (metric, PromQL pattern) → (agg_id, plan) tuple consumed by find_query_config's exact-string match.
  • Adds asap-query-engine/tests/inference_yaml_pattern_coverage.rs (10 tests) pinning the YAML → find_query_configparse_and_match_promqlquery_statistic routing for every new family with synthetic ingest, asserting non-empty / correct-shape vector results.
  • Closes ASAPCollector PROGRESS.md follow-up #4 ("Inference config breadth").

Pre/post coverage

YAML Pre Post
examples/promql/inference_config.yaml 1 entry 33 entries (4 spatial-quantile φ, 12 quantile_over_time φ × range, 6 sum_over_time / count_over_time × range, 5 rate / increase × range, 3 spatial aggregations, 3 topk(N, ...))
examples/sql/inference_config.yaml 1 entry 8 entries (4 multi-quantile φ + sum/count/avg over wider windows)

Per-pattern wiring confirmation

YAML pattern Routes to Backing accumulator Notes
quantile_over_time(φ, m[r]) Statistic::Quantile DDSketchAccumulator, DatasketchesKLLAccumulator Quantile is the canonical warm-tier path; works on KLL + DDSketch
sum_over_time(m[r]) Statistic::Sum DDSketchAccumulator, SumAccumulator, CountSketchAccumulator, CountMinSketchAccumulator SumAccumulator is the simplest backing; sketches answer with no-key totals
count_over_time(m[r]) Statistic::Count DDSketchAccumulator, SumAccumulator, HllSketchAccumulator (HLL aliases Count → Cardinality)
rate(m[r]) / increase(m[r]) Statistic::Rate / Statistic::Increase IncreaseAccumulator, MultipleIncreaseAccumulator KLL has no delta — pair these with Increase-typed streaming aggregations
count(m) Statistic::Count same as above; HLL gives unique-cardinality
sum(m) / avg(m) Statistic::Sum / (Sum, Count) SumAccumulator / DDSketchAccumulator
quantile by (lbl) (φ, m) Statistic::Quantile (spatial) DatasketchesKLLAccumulator
topk(N, m) Statistic::Topk CountSketchAccumulator (row-mean total when no key supplied)

Patterns deliberately NOT added (would require code changes)

  • histogram_quantile(φ, ...). Not in controller_patternsparse_and_match_promql only recognises quantile_over_time for the temporal-quantile shape and sum / count / avg / quantile / min / max / topk for the spatial shape. histogram_quantile queries reach the warm tier today only via the controller's stage-split path (which decomposes them into rate(...) precompute jobs); listing histogram_quantile(...) in the inference YAML would silently fail-to-match against incoming canonical-AST strings.
  • Per-key topk(N, ...) over CountSketch. The query_statistic no-key fallback returns row-mean total volume, not enumerated heavy-hitters. Per-key enumeration needs a paired SetAggregator / DeltaSetAggregator on the agent (already tracked as a follow-up in PROGRESS.md).

Open question

The task references backend-inference.yaml by that exact filename. That file does NOT live in this repo — it's a deployment-side overlay at ASAPCollector/deploy/configs/backend-inference{,-cms,-hll,-kll,-cs}.yaml, which the asap/query-backend:dev image volume-mounts into the container. The canonical schema source for the inference YAML format is the examples/promql/inference_config.yaml template in this repo (consumed via read_inference_configInferenceConfig::from_yaml_file), which this PR expands. A separate PR against ASAPCollector will mirror the same pattern families into the per-sketch deployment overlays.

Test plan

  • cargo test --release -p query_engine_rust --test inference_yaml_pattern_coverage — 10/10 pass.
  • cargo test --release -p query_engine_rust capability_matching — 5/5 pass (no regression to capability-fallback path).
  • cargo test --release -p query_engine_rust structural_matching — 5/5 pass (no regression to AST-canonical match path).
  • cargo test --release -p query_engine_rust file_io::tests::test_read_inference_config — passes (YAML schema unchanged).
  • cargo clippy --release -p query_engine_rust --tests clean for the new test file (5 pre-existing -D warnings errors in engines/simple_engine.rs and count_sketch_accumulator.rs are unrelated to this PR's domain — not touched per file-domain constraints).

Expands the canonical inference YAMLs from one entry per metric
to cover multi-quantile, wider ranges (`[2m]` / `[5m]`), rate /
increase, sum / count over time, spatial aggregations, and top-K.
Each new pattern family is pinned by an integration test that
exercises the YAML → `find_query_config` → `query_statistic`
routing end-to-end against an appropriately-typed accumulator.

Pre/post: PromQL YAML 1 → 33 entries, SQL YAML 1 → 8 entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 4b989ec into main May 5, 2026
@zzylol
zzylol deleted the eval/inference-config-expand-query-patterns branch May 9, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant