Skip to content

mvp #46: add KLL/DDSketch/HLL merge processors, fix gateway emit - #362

Merged
zzylol merged 1 commit into
mainfrom
mvp-46-merge-processors-and-fixes
May 9, 2026
Merged

zzylol merged 1 commit into
mainfrom
mvp-46-merge-processors-and-fixes

Conversation

@zzylol

@zzylol zzylol commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds KLL/DDSketch/HLL merge processors so the controller's typed-stage emit produces YAML the collector can actually load. Without these, gateway emits names (kllmerge, ddsketchmerge, hllmerge) with no registered processor → criterion CountMinSketch in opentelemetry-collector #2 (controller assigns aggregation tasks to executors) silently failed.
  • Fixes Cms merge name in controller stage_config.rs (countminmergecountminsketchmerge, matching the registered processor type).
  • Fixes MVP runner capture loop (was iterating 2 of 6 distinct metrics) and replay-class comment count (6 → 7).
  • Removes legacy GORILLA1 wire-format files unused after Split Gorilla cold path delivery modes #359's cold-path delivery-modes split (tsdb_block_writer.go, encoder.go, window.go, postings.go + their _test.go siblings). 3-mode architecture (best_effort / durable_raw / durable_fragment) unchanged — runtime still uses gorilla.StreamingTSDBBlockBuilder + StreamingFragmentEncoder directly.

Merge processor design

  • Mirrors existing countminsketchmergeprocessor / countsketchmergeprocessor template.
  • Consumes typed sketch metric types (KLLSketch / DDSketch / HLLSketch) instead of Gauge.
  • Accumulator keyed by serialized attribute set (sorted name=value join).
  • processMetrics returns md unchanged — only side effect is the in-memory accumulator map.
  • Encoding handling: Proto/Msgpack supported per family; Delta supported for DDSketch + HLL via ApplyDelta / ApplyRegisterDelta (orphan deltas warned + dropped). KLL has no delta variant in sketchlib-go.

Companion PR

Backend env-var wiring + freshness probe regex generality: ProjectASAP/ASAPQuery-backend#mvp-46-controller-url-and-freshness-probe

Test plan

  • cargo test --manifest-path controller/Cargo.toml -- --test-threads=1 — 621 passed
  • go test ./... in each new processor dir — 4 tests passing each (kllmerge, ddsketchmerge, hllmerge)
  • go test ./... in gorillas3processor — ok (post legacy-deletion)
  • python3 -m pytest deploy/scripts/tests/ -q — 68 passed
  • Smoke run bash deploy/scripts/run_mvp_demo.sh --mode asap and confirm controller-emitted-configs/STATUS == live plus all 6 per-metric snapshots populated
  • Confirm built asap-otel binary loads gateway YAML containing kllmerge: / ddsketchmerge: / hllmerge: / countminsketchmerge: without "unknown processor type" errors

🤖 Generated with Claude Code

Adds the three missing per-family gateway merge processors so the
controller's typed-stage emit produces YAML the patched collector
build can actually load. Without these, the gateway emits names
(`kllmerge`, `ddsketchmerge`, `hllmerge`) that have no registered
processor — every gateway-merge plan silently failed to load and
criterion #2 (controller assigns aggregation tasks to executors)
was unverifiable.

New processors mirror the existing CMS/CountSketch merge processors
but consume typed sketch metric types (`KLLSketch` / `DDSketch` /
`HLLSketch`) and key accumulators by serialized attribute set.
`processMetrics` is pass-through; the only side effect is updating
the in-memory accumulator map (matching existing template).

- KLL: Proto/Unspecified replace; Msgpack/MsgpackDelta reserved
  (warn + drop); no delta variant in sketchlib-go.
- DDSketch: Proto via `NewFromStateProtoBytes`; ProtoDelta via
  `ApplyDelta`; Msgpack via `DeserializeMsgpack`; MsgpackDelta
  reserved (warn + drop).
- HLL: Proto via `DeserializeHyperLogLogFromProtoBytes`; Delta via
  `DeserializeRegisterDelta` + `ApplyRegisterDelta`; Msgpack supported.

Other fixes in same PR:

- controller/src/config/stage_config.rs: Cms merge name was
  `countminmerge` — corrected to `countminsketchmerge`, matching
  the registered processor type. Doc comments updated to reflect
  the family-specific naming convention.
- deploy/scripts/run_mvp_demo.sh: per-metric capture loop now
  iterates all 6 distinct metrics in mvp-workload.yaml (was 2,
  causing 4 sketch families' bindings to be missing from the
  per-metric snapshot used by the §8 verdict). Replay-class
  comment count corrected from 6 to 7.
- gorillas3processor: removed legacy GORILLA1 wire-format files
  unused after PR #359's cold-path delivery-modes split:
  `tsdb_block_writer.go` (test-only shim — runtime uses
  `gorilla.StreamingTSDBBlockBuilder` directly), `encoder.go`,
  `window.go`, `postings.go`, and their _test.go siblings.
  Inlined the 7-line `attributesToMap` helper into `processor.go`;
  added `readAllSamples` test helper into `processor_test.go`.
  The 3-mode architecture (best_effort / durable_raw /
  durable_fragment) is unaffected — runtime path is unchanged.

Verification:
- `go test ./...` in each new processor dir: 4 tests passing each
- `go test ./...` in gorillas3processor: ok
- `cargo test --manifest-path controller/Cargo.toml -- --test-threads=1`:
  621 passed
- `python3 -m pytest deploy/scripts/tests/ -q`: 68 passed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 5d36642 into main May 9, 2026
@zzylol
zzylol deleted the mvp-46-merge-processors-and-fixes branch May 9, 2026 17:52
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