feat: matrix aggregation (aggregate_by + label_matchers) for KLL, HLL, DDSketch processors - #54
Merged
Merged
Conversation
…HLL, DDSketch processors
Adds cross-series (matrix) aggregation to the KLL, HLL, and DDSketch collector
processors via two new config fields:
- `aggregate_by` ([]string): label keys to group by. All data points sharing the
same values for these labels are merged into one sketch per group. The output
data point carries only these labels. Empty (default) preserves the existing
per-series behavior.
- `label_matchers` ([]LabelMatcher{key, value}): exact-match filters applied
before aggregation. A data point is included only if ALL matchers are
satisfied. Empty (default) includes all data points.
Both batch and window modes are supported, and both input paths work unchanged:
- Mode 1 (SDK sends pre-aggregated sketches): incoming sketch data points from
multiple series are merged into one sketch per aggregate_by group.
- Mode 2 (SDK sends raw gauges): raw float64 values from multiple series are
inserted into one sketch per aggregate_by group.
Also adds config-matrix.yaml example for the KLL processor illustrating both modes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closed
SieDeta
pushed a commit
that referenced
this pull request
Apr 17, 2026
feat: matrix aggregation (aggregate_by + label_matchers) for KLL, HLL, DDSketch processors
6 tasks
2 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
aggregate_by(list of label keys) to KLL, HLL, and DDSketch processor configs: all data points sharing the same values for those labels are merged into one sketch per group; the output carries only those labels. Empty = existing per-series behavior (no change).label_matchers(list of exact key=value filters): data points are included only if all matchers are satisfied. Empty = include all (no change).cmd/kll/config-matrix.yamlexample config documenting both SDK source modes.Two source modes (same collector config handles both)
KLLSketch/HLLSketch/DDSketchper series (fine granularity)aggregate_byover the windowGaugefloat64 valuesSDK configuration
Mode 1 — SDK pre-aggregates into sketches, collector merges cross-series
Configure a sketch aggregation view and a 1 s reader interval so each export carries one sketch per series:
The SDK emits one
KLLSketchDataPointper series per reader interval, carrying the serialized sketch bytes + count/sum/min/max. The collector window accumulates these across series and time, then merges them into one sketch peraggregate_bygroup.Mode 2 — SDK sends raw gauge samples, collector builds the sketch
Use the default
LastValueaggregation (no view) and match the reader interval to the sample rate:Collector config
Output as quantile gauges (
transmit_sketch: false, default)The collector queries the merged sketch at the configured quantile points and emits one gauge metric per quantile per group:
Output (Prometheus-scraped):
Output as sketch data points (
transmit_sketch: true)The collector forwards the merged sketch bytes as a
KLLSketchDataPointinstead of emitting quantile gauges. Useful for multi-hop aggregation (e.g. sidecar → regional collector → global collector) where a downstream processor will do the final query:Output: one
KLLSketchDataPointperaggregate_bygroup, with the serialized sketch embedded in thekll.sketch_payloadattribute. A downstream KLL processor set tomode: window+transmit_sketch: falsecan receive and merge these further, then emit the final quantiles.Test plan
kllprocessor:TestAggregateByCollapsesSeries,TestLabelMatchersFilterGauge,TestAggregateByWithLabelMatchersWindowModehllprocessor:TestHLLAggregateByCollapsesSeries,TestHLLLabelMatchersFilterddsketchprocessor:TestDDAggregateByCollapsesSeries,TestDDLabelMatchersFilterGauge,TestDDAggregateByWindowModeDDSketchInput🤖 Generated with Claude Code