refactor(kllprocessor): thin shim delegating to asap-precompute-go (Phase 2 step 2.6) - #226
Merged
Merged
Conversation
KLL processor reduces from ~720 LoC to ~120 LoC shim. State machine moves to asap-precompute-go. sketch_wrapper.go implements QuantileSketch over sketchlib-go KLL. Config.Seed (added in PR #225) flows through. Public test API: Shim.ProcessBatch/ProcessMetrics/FlushWindow. Parity harness: TestParity_KLL byte-identical (3 envelopes). Phase 2 step 2.6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 4, 2026
zzylol
added a commit
that referenced
this pull request
May 4, 2026
Each Phase-2 shim depends on github.com/ProjectASAP/asap-precompute-go, a sibling private module with no module-proxy presence. Mirror the sketchlib-go replace pattern so OCB resolves it to the local checkout. Without this, the multi-plugin sketchcollector binary fails to build once any shim PR (#226-#230) merges. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
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
opentelemetry-collector-contrib-patch/processor/kllprocessor/processor.gofrom a ~720 LoC state machine into a ~150 LoC shim that delegates window / series-keying / snapshot logic togithub.com/ProjectASAP/asap-precompute-go.sketch_wrapper.goimplementingprecompute.QuantileSketchover*kll.KLLSketchfrom sketchlib-go (Snapshot/ApplyDelta/Merge/Reset/Quantile). HonorsConfig.Seed(PR test(integration/parity): all-sketch e2e parity harness #225) so deterministic-replay tests pin compaction RNG.Config.toPrecomputeConfig()translates legacy fields → host-neutralPrecomputeConfig, pinningOmitResourceAttrs=true,EmitWindowStats=false, and threading the metric-name suffix through the shim's encode path (the runtime'sMetricNameis static-per-Precompute; the shim partitions by input metric name).Shim.ProcessBatch,ProcessMetrics,FlushWindow. Existing tests adapted by capitalizingflushWindow→FlushWindow(sed-style rename); no test logic changes.File layout (all under
opentelemetry-collector-contrib-patch/processor/kllprocessor/)processor.goencode.goselfmonitor.gosketch_wrapper.go*kll.KLLSketch→precompute.QuantileSketchadapterTest plan
go test -race ./...inopentelemetry-collector-contrib-patch/processor/kllprocessor/— all 16 existing tests pass under race detector.go test -v -run TestParity_KLL ./...inintegration/parity/— PASS, 3 envelopes byte-identical to legacy emit.TestParity_DDSketch,TestParity_HLL,TestParity_CountSketch,TestParity_CountMinSketch) all still PASS — the shim refactor does not regress unrelated sketches.asap-precompute-gotest suite still green (no source changes there).Behavior preservation (ADR-0002)
mode: window, Batch formode: batch.metricWindowboundary;OmitResourceAttrs=truekeeps the dp-attrs-only key the legacy KLL processor used.<input>_kll(TransmitSketch) or<input>{MetricSuffix}_p<NN>(quantile gauge).MutatesData: truepreserved (batch path appends synthesized RMs onto input md before forwarding, matching legacy).🤖 Generated with Claude Code