refactor(hllprocessor): thin shim delegating to asap-precompute-go (Phase 2 step 2.7) - #228
Merged
Merged
Conversation
HLL processor reduces from ~785 LoC to a thin shim. State machine moves to asap-precompute-go. sketch_wrapper.go implements CardinalitySketch over sketchlib-go HLL. Public test API: Shim.ProcessBatch/ProcessMetrics/FlushWindow. Parity harness: TestParity_HLL byte-identical (3 envelopes). Phase 2 step 2.7. 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
asap-precompute-goruntime (ADR-0002, Phase 2 step 2.7).sketch_wrapper.goimplementsprecompute.Sketch + precompute.CardinalitySketchover sketchlib-go HLL;EstimateCardinality()is the new typed entry point pinned in PR feat(asap-precompute-go): SketchEnvelope MetricName/Count/Temporality + Sketch trait split #224.Precomputemap keyed by metric name,OmitResourceAttrs=true+EmitWindowStats=falseparity flags, publicProcessBatch / ProcessMetrics / FlushWindowtest API per ADR-0002 §"Test API contract".LoC delta
processor.goshrinks from 786 LoC → 264 LoC (state machine moves to runtime). New files:sketch_wrapper.go(216),encode.go(235),selfmonitor.go(63). Total production LoC: 995 across 6 files.Parity result
TestParity_HLLpasses byte-identical (3 envelopes match). Full parity suite green:Notes
AggregationTemporalityCumulative(not Delta like KLL) — matches legacy.<input>_hll_cardinality;MetricSuffixoverrides as before.FlushWindowuses a monotonically-advancing pseudo-tick timestamp so repeated forced rotations don't get stuck on the same already-advanced bucket.(metric, series-attrs)) since the runtime drops the live sketch handle after Tick.Test plan
go test ./...inopentelemetry-collector-contrib-patch/processor/hllprocessor(8 tests, includingdelta_transmission_test.goandintegration_test.go)go test -race ./...cleango vet ./...cleango test -v -run TestParity_HLL ./integration/parity/...byte-identicalgo test ./integration/parity/...) green🤖 Generated with Claude Code