Skip to content

fix(promql): bind temporal TopK update semantics on the shared workload plan - #505

Merged
zzylol merged 8 commits into
mainfrom
feat/501-promql-compatibility
Sep 8, 2026
Merged

fix(promql): bind temporal TopK update semantics on the shared workload plan#505
zzylol merged 8 commits into
mainfrom
feat/501-promql-compatibility

Conversation

@zzylol

@zzylol zzylol commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Why

Temporal TopK must rank series by the selected producer's update semantics. A count contributes one per observation; a sum contributes the sample value. Losing this distinction, series identity, or materialization identity returns incorrect winners.

Before this PR

The branch used an obsolete Planner readout-weight API, conflicted with the workload migration, and a single-series fixture could not prove ranking correctness.

After this PR

For one window, api has four observations summing to 10, worker has two summing to 200, and cron has three summing to 30:

  • topk(1, sum_over_time(m[5s])) returns worker=200.
  • topk(1, count_over_time(m[5s])) returns api=4.

The next window changes the sum winner to api=26. Instant/range tests check winners, values, cardinality and timestamps. The existing backend item label contains canonical series identity; native Prometheus label reconstruction is not claimed here.

Implementation and dependencies

Based on #522; merge the #513#522 stack first. Planner #356 and #357 are merged; this branch pins revision c3410d14865497758d212e4265ad25c782187de1.

Validation

  • 656 control-plane library tests passed.
  • 977 data-plane library tests passed with --test-threads=1. The first parallel run had five persistence failures; an isolated rerun and the serial suite passed.
  • Two compatibility process tests passed, including exact shared dashboard and temporal TopK.
  • Distributed production-process test passed with actual Collector Rust runtime.
  • Select complete bound workloads with strict cost and capability evidence #522's exact-only quote-preparation regression and all 29 control-plane binary tests passed.

Self-review, not independent approval. Legacy sketch-envelope fixture failures tracked on #511 are not covered by the canonical-profile acceptance above. No merge performed.

Closes #502. Contributes the #706 rows of #501.

Planner #357 compatibility update

Synchronizes the latest #522 changes, including complete exact-fallback input-source costing, and pins merged Planner revision c3410d14865497758d212e4265ad25c782187de1. Retains the reviewed backfill fixes: policy-aware series IDs and shared live/replay TopK update semantics. Regenerate cost manifests and quotes for the new Planner revision.

Latest combined-stack validation with Planner #357: 658 control-plane library tests, 29 control-plane binary tests, one control-plane integration test, 978 data-plane library tests (serial), two compatibility process tests, and the distributed production-process test passed. An initial data-plane run exhausted the machine's root filesystem; the full rerun passed using a temporary directory on /mydata.

@zzylol zzylol added enhancement New feature or request area: control plane Planning, configuration, routing, and control-plane orchestration area: data plane Runtime ingestion, storage, and query-serving data paths area: query engine PromQL lowering, execution, result shaping, and fallback behavior area: physical compiler Compilation from selected logical plans to executable backend and Collector plans area: summary execution Warm-summary binding, readout, composition, and result decoding integration: ASAPPlanner ASAPPlanner API, IR, candidate, and selected-plan integration feature: PromQL PromQL compatibility and execution semantics feature: warm summaries ASAP warm-tier materialization, readiness, and serving feature: sketch algorithms Sketch-family configuration, lifecycle, merge, and readout behavior feature: range evaluation Range-query steps, windows, timestamps, and temporal evaluation feature: Top-K Top-K planning, heap materialization, ranking, and labels test: end-to-end Process-boundary, differential, conformance, and full-stack tests labels Sep 4, 2026
@zzylol
zzylol changed the base branch from main to feat/complete-workload-cost-selection September 8, 2026 13:10
@zzylol zzylol changed the title feat(promql): support topk over temporal sums and counts fix(promql): bind temporal TopK update semantics on the shared workload plan Sep 8, 2026
@zzylol
zzylol changed the base branch from feat/complete-workload-cost-selection to main September 8, 2026 20:19
@zzylol
zzylol merged commit 3ca9828 into main Sep 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: control plane Planning, configuration, routing, and control-plane orchestration area: data plane Runtime ingestion, storage, and query-serving data paths area: physical compiler Compilation from selected logical plans to executable backend and Collector plans area: query engine PromQL lowering, execution, result shaping, and fallback behavior area: summary execution Warm-summary binding, readout, composition, and result decoding enhancement New feature or request feature: PromQL PromQL compatibility and execution semantics feature: range evaluation Range-query steps, windows, timestamps, and temporal evaluation feature: sketch algorithms Sketch-family configuration, lifecycle, merge, and readout behavior feature: Top-K Top-K planning, heap materialization, ranking, and labels feature: warm summaries ASAP warm-tier materialization, readiness, and serving integration: ASAPPlanner ASAPPlanner API, IR, candidate, and selected-plan integration test: end-to-end Process-boundary, differential, conformance, and full-stack tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(promql): support topk over sum_over_time/count_over_time (ASAPQuery #706 parity)

1 participant