Repository navigation
refactor(rqe-optimizer): Raqe input model in ms, spatial filter, per-RAQE latency SLA, deployable families - #148
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lookback, interval, window, slide and scrape interval are Millis. Rates (CPU-sec/sec, samples/sec) stay per second via secs(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unds Stream identity is now (capability, metric, spatial_filter, grouping_labels). spatial_filter is opaque matcher text used for identity only. The latency limit moves from MilpBounds onto each Raqe; the example's --latency-limit RAQE_ID=SECONDS becomes --latency-sla RAQE_ID=MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DEPLOYABLE_FAMILIES lists the variants ASAPQuery's engine runs, each with its AggregationType. Candidate generation and the AutoSketch baseline both go through Capability::deployable_families(), so dd, univmon-* and countsketch-heap are measured but never planned. AutoSketch's chooses_the_cheaper_variant test is removed: no capability has two deployable variants until hydra-kll is measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milindsrivastava1997
left a comment
Contributor
Author
There was a problem hiding this comment.
Code review findings (10). Nine are inline below. One is on a file this PR doesn't touch:
scripts/export_rqe_optimizer_costs.sh: the export script still benchmarks dd, univmon-cardinality, univmon-topk and countsketch-heap-topk, which can no longer become candidates (deployable_families() discards their rows). Its header still says it measures what Capability::families() names. That makes every cost-table regeneration slower than needed, and the header is misleading.
- Latency is modeled in ms end to end (PlanCost::query_latency_ms), so the SLA compares without a unit conversion and the example prints ms. - validate_facts rejects non-finite or non-positive latency SLAs, and non-empty spatial filters until facts carry per-filter cardinality. - small_problem rejects --latency-sla without --milp. - Deployable-family test checks each entry is in some families(). - Restore AutoSketch's cross-variant test via search_variants(). - Fix the families() and export-script comments; drop redundant spatial_filter fields in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build_all_candidates(_unpruned) take allow_undeployable_families; when set, every measured family in Capability::families() becomes a candidate. The small_problem example exposes it as --allow-undeployable-families. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Capability::candidate_families(allow_undeployable_families) is the one family rule; candidate generation and AutoSketch's plan/search both take the flag, so the baseline sees the same sketches as the MILP. - validate_facts rejects zero lookback/interval and ones that aren't multiples of the scrape interval. - Candidate windows come from divisors(L / scrape) × scrape. - small_problem rejects --latency-sla with --candidates-only or --sample-mappings, and non-finite SLAs. - Capability::ALL for the deployable-family test; spatial_filter in the pruning comment and the TODO doc. Co-Authored-By: Claude Opus 5.5 <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.
Finishes the remaining parts of S1 and S6 from #143. #145 already did
metric/grouping_labels(S1) and the scrape-interval multiples (S6).Interface changes later sessions depend on
Rqe→Raqe(rqe-optimizer/src/lib.rs)accuracy_tolerance→accuracy_sla.spatial_filter: String: canonical PromQL matcher text,""for none. It is part of stream identity, compared as an opaque string.validate_factsrejects a non-empty filter for now, because facts have no per-filter cardinality and a filtered stream would be costed as the whole metric.latency_sla_ms: Option<f64>: a hard ceiling on modeled query latency. Only the MILP enforces it.validate_factsrejects values that are non-finite or ≤ 0.(capability, metric, spatial_filter, grouping_labels).Deploymentcarriesspatial_filtertoo.Milliseconds everywhere.
Seconds→Millis(u64), and*_secs→*_msforlookback,interval,window,slideandMetricFacts::scrape_interval. Rates (CPU-sec/sec, samples/sec) stay per second. Latency is in ms too:PlanCost::query_latency_secs→query_latency_ms.validate_factsrejects a zero lookback or interval, and any lookback or interval that isn't a multiple of the metric's scrape interval. That catches values left in seconds.MilpBoundsremoved.milp::minimize(raqes, deployments, facts, objective)reads each Raqe'slatency_sla_ms. In the example,--latency-limit RAQE_ID=SECONDSbecomes--latency-sla RAQE_ID=MS.Allowed families (S6). These are hardcoded, not taken as input:
DEPLOYABLE_FAMILIESlists the variants ASAPQuery's engine runs (middle column). The rest ofCapability::families()is measured but undeployable:AggregationType)--allow-undeployable-families)ASAPQuery engine types not in this table yet: HydraKLL (Quantile) joins
families()andDEPLOYABLE_FAMILIESonce S5/S4b measure it. SetAggregator and DeltaSetAggregator (exact Cardinality) have no sketch-bench family; DeltaSet is planned only as HydraKLL's key tracker (S5/S4b).By default, candidate generation and the AutoSketch baseline only use deployable families, so dd, univmon-* and countsketch-heap are measured but not planned.
--allow-undeployable-families.build_all_candidates,build_all_candidates_unpruned,autosketch::planandautosketch::searchtakeallow_undeployable_families: bool. All of them choose families through one rule,Capability::candidate_families(allow_undeployable_families). When the flag istrue, every measured family inCapability::families()is a candidate. Use it for studies only: the resulting plan can't be deployed. Thesmall_problemexample exposes it as--allow-undeployable-families. AutoSketch takes the same flag, so the baseline and the MILP always plan with the same sketches. In ASAPQuery, A3/A5 can pass the flag through to print the plan and its cost without writing YAML. hydra-kll joinsfamilies()and this list once S5/S4b measure it. ASAPQuery'ssketch_bench_keydoesn't map CountMinSketchWithHeap yet, so A3 needs to add that mapping.Notes
search(..., allow_undeployable_families: true)over both TopK families. No capability has two deployable variants until hydra-kll.rqe(rqe-optimizer,export_rqe_optimizer_costs.sh). Only the types and identifiers were renamed.Test plan
cargo test -p rqe-optimizer(39 pass): new tests for spatial-filter separation, undeployable families being candidates only with the flag, each deployable family being in somefamilies()(iteratingCapability::ALL), andvalidate_factsrejecting bad SLAs, spatial filters, zero times, and times that aren't multiples of the scrape interval.small_problem --milp --latency-sla …builds candidates. A full solve needs a fresh S5 export: the local cost table predates rqe-optimizer: exact sum/min-max/increase accumulators, CountSketch+heap and UnivMon top-k #144 and has noexact-*rows.🤖 Generated with Claude Code