feat(control_plane): plumb per-metric sample_p from workload to agent emit - #339
Merged
Merged
Conversation
… emit Add an optional per-metric sketch sampling probability so an operator can turn on the warm-sketch sampling per metric. WorkloadEntry gains a sample_p field (default 1.0, sampling disabled). The planner threads it into EdgeStageConfig.metric_to_sample_p via collect_metric_to_sample_p (mirroring the metric_to_grouping_labels / cumulative_counter_metrics stitch in both the bootstrap and replan paths), and the L5 edge emitter writes a sample_p knob onto the CMS / HLL sketch-processor block in build_edge_processor_block (and the fused asap_edge per-metric entries), guarded so it is only emitted when p < 1. Default 1.0 everywhere keeps the map empty and emits no sample_p key, so the agent config is byte-identical to today when unset; out-of-range values are validated (logged and skipped) at collection and re-guarded at emit. Tests cover the workload field default/parse and that a configured p<1 reaches the emitted agent YAML for CMS + HLL while 1.0/unset emits nothing. This is a static operator-set knob; an optimizer-driven dynamic p is a follow-up. Requires the agent-side sample_p support (CMS/HLL processor + precompute WithSampleP) to be merged first. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Add an optional per-metric sketch sampling probability
pso an operator can turn on the warm-sketch sampling per metric from the control plane.WorkloadEntrygains asample_pfield (workload YAML, default1.0= sampling disabled).EdgeStageConfig.metric_to_sample_pvia a newcollect_metric_to_sample_pcollector — wired in both the bootstrap (main::emit_bootstrap_typed) and replan (replan.rs) paths, mirroring the existingmetric_to_grouping_labels/cumulative_counter_metricsstitch.sample_pknob onto the CMS / HLL sketch-processor block inbuild_edge_processor_block(and the fusedasap_edgeper-metric entries), via a sharedinsert_sample_phelper guarded so it is only emitted whenp < 1.Full path (file:func at each hop)
control_plane/src/workload.rs—WorkloadEntry::sample_p(operator field, default 1.0).control_plane/src/emit/mod.rs—collect_metric_to_sample_p()(validates(0,1], skips 1.0/out-of-range).control_plane/src/main.rs::emit_bootstrap_typed+replan.rs— stitch intoEdgeStageConfig.metric_to_sample_p.control_plane/src/physical/colored_dag/emitter.rs—EdgeStageConfig::metric_to_sample_pfield.control_plane/src/emit/stage_config.rs::build_edge_processor_block→insert_sample_p— emitssample_p:on the CMS/HLL agent YAML block.countminsketchprocessor/hllprocessorConfig.SampleP→sketchlib-go WithSampleP(companion agent PR).Default
1.0everywhere keeps the map empty and emits nosample_pkey ⇒ byte-identical agent config when unset.Test plan
cargo build+cargo testgreen (775 lib + 28 integration).WorkloadEntry.sample_pdefault/parse; a configuredp<1reaches the emitted agent YAML for CMS + HLL;1.0/unset emits nothing.cargo check --bin data_planeis currently red in this checkout due to a pre-existingasap-precompute-rsvsasap_sketchlibproto skew (missing sample_p/registers_sparsein regenerated proto, plus renamed sketch types) —asap-precompute-rsfails standalone, independent of this PR. This change is additive control-plane-internal types;cargo build -p control_plane(whatdata_plane's control_plane dep needs) is green.Merge order
Merge the agent PR first: ProjectASAP/ASAPCollector#441 (CMS/HLL processor
sample_p+ precomputeWithSampleP). This PR emits that agent config.Out of scope / follow-up
Dynamic, optimizer-driven
p(tuned online from runtime samples against an accuracy/bandwidth budget) — this PR ships only the static per-metric knob.🤖 Generated with Claude Code