Skip to content

feat(otel-app): coordinator-driven (CDM) warm-metric sampling at the producer - #486

Merged
zzylol merged 1 commit into
mainfrom
feat/producer-coordinated-sampling
Jun 12, 2026
Merged

zzylol merged 1 commit into
mainfrom
feat/producer-coordinated-sampling

Conversation

@zzylol

@zzylol zzylol commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Makes the producer (otel-app, the "SDK") sample its warm sketch metric at a probability p — statically or driven by the CDM coordinator's grant — so dropped points never traverse the network or hit the collector. Demonstrated on the real 2019 Google cluster trace.

Changes (all in otel-app/)

  • -warm-sample-p float (default 1.0): geometric drop of the warm metric's datapoints before SDK aggregation; now applies on the replay (-trace-file) path too (was synthetic-only). + -trace-metric-name, -agg dd-full projection for the eval.
  • sample_controller.go: otel-app is now a CDM edge — imports asap-precompute-go/monitor + monitor/grpcclient, reports its per-window warm-metric rate, and applies grant.SampleP as the live warm-sample-p at the next window boundary (never mid-window).
  • COORDINATED_SAMPLING.md: the design + how to run it.

Evidence (real 2019 Google cluster trace, 50k rows)

Accuracy — DDSketch quantile vs true quantile, sweeping p:

p rel-err p99 rel-err p50 ingest pts/s
1.0 0.34% 0.29% 1667
0.5 0.34% 0.29% 832
0.25 1.69% 0.29% 417
0.1 1.86% 1.23% 165

Rel-err stays ≈ DDSketch α (~1–2%) as p sweeps 10×, ingest drops ∝ p (rank-preserving quantiles → no 1/p rescale).

Coordinated p — two skewed edges vs data_plane --enable-monitor-coordinator: hot edge (~50k/win) applied granted p=0.0065, quiet edge (~500/win) kept p=1.0 — differentiated by the ε-coupling floor 1/(1+ε²·rate).

Builds clean (go build, go vet). The coordinator/edge plumbing is the merged CDM coupling (#368/#481); this wires the producer end.

🤖 Generated with Claude Code

- Apply -warm-sample-p to the trace-replay warm gauge (was synthetic-only),
  with -trace-metric-name to land the replayed series under a DDSketch-
  aggregated name (e.g. google_cluster_2019_cpu_rate) for the accuracy sweep.
- Add CDM edge wiring (sample_controller.go): -coordinator-url / -monitor-agg-id
  / -edge-id make the producer report its per-window warm-metric rate to the
  data-plane monitor coordinator and apply the granted SampleP as the live
  warm-sample-p at the next window boundary (never mid-window), via the nested
  asap-precompute-go/monitor + monitor/grpcclient modules.
- REPLAY_STATS log line (candidate/admitted) for ingest-load accounting.

Verified: otel-app builds clean; two skewed edges → coordinator grants the
hot edge p≈0.0065 (then 0.0113) while the quiet edge keeps p=1.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit dbff118 into main Jun 12, 2026
@zzylol
zzylol deleted the feat/producer-coordinated-sampling branch June 12, 2026 13:41
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