Add positional aggregator interface - #423
Open
pedro-stanaka wants to merge 7 commits into
Open
Conversation
pedro-stanaka
force-pushed
the
pedro-stanaka/positional-aggregator-api
branch
from
July 21, 2026 20:47
9e8a5f0 to
8c5f144
Compare
pedro-stanaka
marked this pull request as ready for review
July 21, 2026 21:06
pedro-stanaka
force-pushed
the
pedro-stanaka/positional-aggregator-api
branch
from
August 17, 2026 18:07
6467d3c to
c67ae86
Compare
pedro-stanaka
marked this pull request as draft
August 17, 2026 18:07
pedro-stanaka
force-pushed
the
pedro-stanaka/positional-aggregator-api
branch
from
August 18, 2026 09:00
96473eb to
c67ae86
Compare
Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
Co-authored-by: AI (Pi/GLM 5.2 Fast (Fireworks) [300k]) <noreply@pi.dev> Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
- Remove KeywordTestAggregator: call Aggregator positionally in tests - Remove PositionalAggregator mock: use real Aggregator with CaptureSink - Delete test_default_aggregator_uses_positional_dispatch (implementation detail) - Delete test_aggregator_entrypoints_use_fixed_positional_arguments (already removed) Co-authored-by: AI (Pi/GLM 5.2 Fast (Fireworks) [300k]) <noreply@pi.dev> Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
Co-authored-by: AI (Pi/GLM 5.2 Fast (Fireworks) [300k]) <noreply@pi.dev> Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
Co-authored-by: AI (Pi/GLM 5.2 Fast (Fireworks) [300k]) <noreply@pi.dev> Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
Co-authored-by: AI (Pi/GLM 5.2 Fast (Fireworks) [300k]) <noreply@pi.dev> Assisted-By: devx/2d33ac09-1dc1-4608-a505-946e99eed108
pedro-stanaka
force-pushed
the
pedro-stanaka/positional-aggregator-api
branch
from
August 18, 2026 09:12
c67ae86 to
eec17f5
Compare
pedro-stanaka
marked this pull request as ready for review
August 18, 2026 10:00
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.
Why
Aggregation is currently hard-coded to the built-in implementation and receives metric options as keyword arguments. The aggregator is an internal hot-path interface, so a single fixed-arity positional contract is simpler, cheaper to dispatch, and easier to implement with alternative aggregation strategies.
What changed
Make the internal aggregator interface positional-only:
Keep the public
Clientmetric API unchanged, including its keyword options.Add optional
aggregator:injection toClient.newand.from_env.Preserve an injected aggregator through
with_options/clone_with_optionsunless explicitly overridden.Providing
aggregator:implicitly enables aggregation.Convert untagged aggregation calls to one shared frozen empty array; other tag values are forwarded as-is, so custom implementations may require canonical arrays.
Keep sampling in
Clientbefore aggregation dispatch.Keep the existing precompiled aggregation methods and
flushas part of the aggregator contract.Document the interface and add a changelog entry.
Compatibility
Public
StatsDandClientmetric methods keep their existing signatures and behavior. Code that directly calls or prepends the internalAggregatormethods must update to the positional signatures.Injected aggregators own prefix/default-tag policy and lifecycle behavior. Cloned clients reuse the injected instance unless
aggregator:is overridden.Performance
Linux arm64, Ruby 3.4.10 + YJIT, 1M calls:
A five-process before/after run found no regression in existing direct or CompiledMetric paths. Representative medians:
Validation
bundle exec rake test— 397 runs, 1,111 assertions, 0 failures/errorsbundle exec rubocop— 79 files, no offenses#gsd:52109