refactor(processors): drop shim_helpers workaround, import sketches/ wrappers - #235
Merged
Merged
Conversation
…wrappers Two cleanups, both enabled by PR #232: 1. CountSketch and CMS shims drop the applyDeltaTransmission workaround (shim-side snapshot cache that mirrored legacy delta-refresh semantics). Runtime's SnapshotCache::ComputeDelta now always-refreshes correctly, so the workaround is redundant. 2. All 5 shims (DDSketch / KLL / HLL / CountSketch / CMS) drop their per-processor sketch_wrapper.go files and import the canonical wrappers from asap-precompute-go/sketches/. Net: each shim shrinks by ~150-300 LoC. Parity harness still all-PASS byte-identical. 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
Two cleanups across all 5 OTel sketch processor shims, both enabled by PR #232 (which fixed
SnapshotCache::ComputeDelta's always-refresh invariant and extracted the canonical wrappers intoasap-precompute-go/sketches/):applyDeltaTransmissionworkaround. PR refactor(countsketchprocessor): thin shim delegating to asap-precompute-go (Phase 2 step 2.8) #229 / refactor(countminsketchprocessor): thin shim delegating to asap-precompute-go (Phase 2 step 2.9) #230 introduced a shim-side per-series snapshot cache that mirrored legacy delta-refresh semantics to work aroundSnapshotCache::ComputeDelta's prior "refresh-only-on-full" bug. PR fix(asap-precompute-go): SnapshotCache always-refresh + extract common sketch wrappers #232 fixed the bug, so the workaround is redundant. The CMS shim now wiresDeltaTransmission: c.DeltaTransmissionstraight through to the runtime; CountSketch already wired it through (the workaround code never landed there).sketch_wrapper.goand import the canonical wrappers fromasap-precompute-go/sketches/instead. Identifier renames:ddSketchWrapper→sketches.DDSketchWrapper,newDDSketchWrapper→sketches.NewDDSketchWrapper,ddSketchObserver→sketches.DDSketchObserver, etc. — matching the public API on the common library.Net: 17 files changed, 173 insertions(+), 1193 deletions(-) — ~1020 LoC removed across 5 shims (each shim shrinks by ~150-300 LoC).
A handful of test-only helpers (
newKLLSketch,serializeKLLSketch,serializeCMS,deserializeCMS,cloneHLL) were the only non-wrapper code in the deleted files; they were preserved in newtest_helpers_test.gofiles (test-build-only) so existing test suites don't need rewrites. One DDSketch helper (decodeDDSketchEnvelope) is consumed by the shim's quantile-emission path and was inlined intoshim_helpers.gosince the canonical sketches package keeps its decoder unexported.One downstream test fix:
TestCSDelta_MultipleWindowsConvergencewas written expecting the pre-#232 buggy semantics (delta against a fixed first baseline); updated to apply each delta to the previous reconstruction, matching the now-correct always-refresh behavior.Test plan
go test -racegreen for all 5 processors (ddsketch/kll/hll/countsketch/countminsketch)asap-precompute-go/orintegration/parity/🤖 Generated with Claude Code