refactor(countsketchprocessor): thin shim delegating to asap-precompute-go (Phase 2 step 2.8) - #229
Merged
Merged
Conversation
…te-go CountSketch processor reduces from ~663 LoC to a thin shim. State machine moves to asap-precompute-go. sketch_wrapper.go implements FrequencySketch over sketchlib-go CountSketch. GlobalAggregation + EmitWindowStats config flags preserve legacy single-partition emit shape with sample_count / window_duration_seconds attrs. Public test API: Shim.ProcessBatch/ProcessMetrics/FlushWindow. Parity harness: TestParity_CountSketch byte-identical (1 envelope). Phase 2 step 2.8. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
zzylol
added a commit
that referenced
this pull request
May 4, 2026
…n sketch wrappers (#232) Correct SnapshotCache semantics — every ComputeDelta updates the cached snapshot, matching all 5 legacy OTel processors. The previous "refresh-only-on-full" path was a design error; no configurable policy knob is needed because there's only one correct behavior. Extract platform-independent sketch wrappers (DDSketch, KLL, HLL, CountSketch, CountMinSketch) into asap-precompute-go/sketches/ so Telegraf / Vector / OTAP adapters can reuse them. Document delta-snapshot semantics in design doc. Note: PR #229 (CountSketch) and PR #230 (CMS) workaround in shim_helpers.go::applyDeltaTransmission becomes redundant after this lands; those PRs can rebase to drop the workaround. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 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
asap-precompute-go.sketch_wrapper.goimplementsprecompute.Sketch+precompute.FrequencySketch(EstimateCount,TopK) over the sketchlib-goCountSketch.GlobalAggregation=true,OmitResourceAttrs=true,EmitWindowStats=true, fixedMetricName=countsketch_partitionpreserve the legacy single-partition emit shape withsample_countandwindow_duration_secondsattrs.GlobalAggregationcollapses every observation into one shared series — no per-metric map is needed.Shim.ProcessBatch,Shim.ProcessMetrics,Shim.FlushWindow.delta_transmission_test.goTestCSDelta_MultipleWindowsConvergenceupdated to apply each delta against the cached baseline (the runtime'sSnapshotCache.ComputeDeltakeeps outbound at the prior baseline whenever delta stays under threshold) instead of the previously-reconstructed sketch.Phase 2 step 2.8.
Test plan
cd opentelemetry-collector-contrib-patch/processor/countsketchprocessor && go test ./...passescd integration/parity && go test -v -run TestParity_CountSketch ./...parity OK: 1 envelope byte-identicalcd integration/parity && go test ./...(full parity suite) passes🤖 Generated with Claude Code