Skip to content

Commit 0032c81

Browse files
docs(planner): keep top-k in the optimizer example workload
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 98c88c3 commit 0032c81

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎.design_docs/optimizer-label-set-facts.example.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ series:
33
- {metric: http_requests_total, spatial_filter: 'env="prod"', series_count: 200}
44
- {metric: latency_ms, spatial_filter: "", series_count: 50}
55
groups:
6-
# sum by (job): output labels [job].
6+
# sum by (job): output labels [job]; also the `topk by (job)` buckets.
77
- {metric: http_requests_total, spatial_filter: 'env="prod"', grouping_labels: [job], cardinality: 10}
8+
# topk keeps every label: output labels are all of them.
9+
- {metric: http_requests_total, spatial_filter: 'env="prod"', grouping_labels: [env, instance, job], cardinality: 200}
810
# quantile_over_time keeps every label.
911
- {metric: latency_ms, spatial_filter: "", grouping_labels: [instance], cardinality: 50}

‎.design_docs/optimizer-v1-implementation-plan.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ Takes the same `ControllerConfig` YAML format as `asap-planner --input_config`;
353353
`metrics:` hints are required and must cover every workload metric, since they supply the
354354
label schema. `--label-set-facts` is a YAML file of externally provided facts — the optimizer
355355
never estimates them (example: `optimizer-label-set-facts.example.yaml`, for the workload
356-
`optimizer-workload.example.yaml`):
356+
`optimizer-workload.example.yaml`; its top-k query needs `--atomic-costs` with a CMS-with-heap
357+
reference row, otherwise the run fails with that item listed as unservable):
357358

358359
```yaml
359360
series: # per (metric, spatial_filter)
@@ -378,7 +379,8 @@ containing the exact `profiles[].workload` value from that benchmark artifact.
378379
The loader validates the document schema and rejects a selector that matches
379380
zero or multiple profiles; it never mixes entries across workloads. Omit both
380381
flags and ordinary unbenchmarked candidates use the flat stub, while
381-
CMS-with-heap candidates warn and are dropped until a matching reference row is available.
382+
CMS-with-heap candidates warn and are dropped until a matching reference row is available;
383+
an item left with no candidate makes the run fail, listing every unservable item.
382384

383385
### Running with real sketch-bench costs
384386

‎.design_docs/optimizer-workload.example.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Example workload for asap-optimizer-cli; facts in optimizer-label-set-facts.example.yaml.
2+
# The top-k query is only servable with --atomic-costs containing a CMS-with-heap
3+
# reference row; without it the optimizer reports it as unservable.
24
query_groups:
35
- queries:
46
- 'sum by (job) (http_requests_total{env="prod"})'
57
- 'quantile_over_time(0.99, latency_ms[5m])'
8+
- 'topk by (job) (5, sum_over_time(http_requests_total{env="prod"}[5m]))'
69
repetition_delay_ms: 60000
710
metrics:
811
- {metric: http_requests_total, labels: [job, instance, env]}

0 commit comments

Comments
 (0)