fix: Pass metric_prefix to Aggregator finalizer#416
Merged
kelhusseiny merged 3 commits intomainfrom Feb 9, 2026
Merged
Conversation
The Finalizer struct expects 6 arguments but only 5 were passed, leaving metric_prefix as nil. This caused metrics to lose their prefix when flushed during garbage collection. The bug only manifests when: 1. Aggregator is created with a prefix 2. Metrics are added without tags (tags trigger datagram_builder creation) 3. GC runs before normal flush, triggering the finalizer
sharadgaur
approved these changes
Feb 9, 2026
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
Fixes a bug where
metric_prefixwas not passed to theFinalizerstruct, causing metrics to lose their prefix when flushed during garbage collection.Root Cause
The
Finalizerstruct expects 6 arguments:But only 5 were passed:
This left
metric_prefixasnil, so when the finalizer flushed metrics during GC, they would be emitted without the configured prefix.When the bug manifests
The bug only occurs when all these conditions are met:
"MyApp")datagram_buildercreation viatags_sorted)When tags are present,
tags_sortedcreates thedatagram_builderwith the correct prefix, masking the bug.Test plan
test_finalizer_with_prefixthat verifies the finalizer preserves metric prefixdatagram_builderis not pre-created