Skip to content

feat: execute Planner-selected exact per-series range-max indexes - #531

Merged
zzylol merged 4 commits into
mainfrom
feat/filtered-series-gauge-window
Sep 8, 2026
Merged

zzylol merged 4 commits into
mainfrom
feat/filtered-series-gauge-window

Conversation

@zzylol

@zzylol zzylol commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Before this PR

The real o11y gauge max queries selected exact Planner MinMax nodes but executed by scanning retained samples. Binding a pooled scalar accumulator would lose source labels, and rounding queries to closed panes would change their time intervals.

After this PR

Compile proven Planner-selected per-series max leaves into an explicit ReadRangeMaxIndex node. The backend retains complete series labels and applies the original matchers while querying exact (t-range, t] sample bounds. Min, offset and subquery forms are not rewritten into this index. Two filters/windows over one metric share per-series index state.

Finite-input drain eagerly builds indexes before reporting complete. Admission invalidates the immutable prepared generation; subsequent preparation rebuilds its indexes. Index construction, update, residency and retirement have explicit cost components alongside retained raw input. Index bytes are exposed separately and already included in total raw-store bytes. Summary readout counters advance only on actual index access.

This is an exact materialized index, not a sketch. The complete 24-query candidate contains three indexed real queries over two metrics; native execution remains a separately priced alternative. No benchmark winner is forced, and this PR makes no measured acceleration claim. Live-update rebuilding and retained input remain part of the resource cost.

Validation on integrated main: 685 control-plane library tests and 1,009 data-plane library tests pass, including Planner/cost contracts, exact interval/stale/NaN/signed-zero behavior, eager drain, the real :56 query timestamp, multiple labels/matchers, reuse and post-admission invalidation. Control-plane/data-plane formatting checks pass. #530 is merged; this branch includes current main ancestry.

Real workload evidence

The frozen b02ddd6 candidate was measured against Prometheus with the complete o11y workload. Its adaptive calibration produced 1,753/1,753 correct responses, including 271 actual indexed warm reads across the three real gauge-max queries. The native candidate produced 692/692 correct responses. Adaptive repetition counts differ, so these totals are not a performance comparison.

Under the same measured inclusive CPU cost model, estimated finite-batch cost was 7.982 CPU seconds for the indexed/local candidate versus 7.645 for native execution. Ordinary control-plane selection therefore chose native execution. Its subsequent matched trial returned 560/560 correct, all external exact fallback: backend-plus-fallback request CPU was 5.360 seconds versus Prometheus baseline 2.780 seconds, and mean request latency was 9.551 ms versus 5.086 ms. This trial demonstrates no overall acceleration or resource saving.

Index state measured 1,310,720 bytes, already included in retained raw/prepared state of 16,582,450 bytes. Construction is included in the finite drain/build phase. Detailed reproducibility artifacts: gauge-calibration/measurements.json, gauge-selected-plan.json, gauge-selected-comparison/trial-1/replay/comparison.json, and GAUGE-INDEX-REPORT.md/.json in the acceptance results bundle.

The final integrated compiler at 5034b65 exports exactly the same candidate JSON structures as frozen b02ddd6, including both installation requests, both cost manifests and both plan IDs (gauge-integrated-equivalence.json). Runtime measurement provenance remains explicitly b02ddd6; this equivalence check is not a new benchmark.

@zzylol
zzylol changed the base branch from feat/o11y-acceptance to main September 8, 2026 21:27
@zzylol
zzylol merged commit 915a593 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant