feat(aggregation): expose extra fields for aggregations#2827
Closed
feat(aggregation): expose extra fields for aggregations#2827
Conversation
This change modifies the Average aggregation to return sum and count
alongside the computed average value, enabling downstream systems to
properly merge results across multiple query steps.
Changes:
- Add AverageMetricResult struct with value, sum, and count fields
- Add sum() and count() getter methods to IntermediateAverage
- Update MetricResult::Average to use AverageMetricResult
- Update finalization to populate sum/count from intermediate result
- Update tests to expect new JSON format
JSON output changes from:
{ "value": 2.5 }
to:
{ "value": 2.5, "sum": 15.0, "count": 6 }
This is a breaking change for JSON consumers expecting the old format.
Collaborator
|
|
This change extends the multi-step query support to percentiles and
cardinality aggregations by exposing their underlying sketches.
Changes:
- Add CardinalityMetricResult struct with value and HLL sketch
- Update PercentilesMetricResult to include DDSketch
- Update MetricResult::Cardinality to use CardinalityMetricResult
- Update finalization to include sketches in results
- Add tests verifying sketch data is present in results
JSON output changes:
Percentiles:
Before: { "values": {...} }
After: { "values": {...}, "sketch": {...} }
Cardinality:
Before: { "value": 10.0 }
After: { "value": 10.0, "sketch": {...} }
The sketch fields enable downstream systems to merge results across
multiple query steps using the raw sketch data.
Collaborator
Author
While reusing |
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
This change modifies the Average aggregation to return
sumandcountalongside the computed average value, enabling downstream systems to properly merge results across multiple query steps.Changes
AverageMetricResultstruct withvalue,sum, andcountfieldssum()andcount()getter methods toIntermediateAverageMetricResult::Averageto useAverageMetricResultJSON Output Change
Before:
{ "value": 2.5 }After:
{ "value": 2.5, "sum": 15.0, "count": 6 }