Add Optional Ephemeral Scope Handling#269
Open
rahultejwani wants to merge 1 commit intouber-go:masterfrom
Open
Add Optional Ephemeral Scope Handling#269rahultejwani wants to merge 1 commit intouber-go:masterfrom
rahultejwani wants to merge 1 commit intouber-go:masterfrom
Conversation
…Cases This change adds mechanisms to avoid caching subscopes when dealing with high cardinality metrics, which prevents memory leaks and improves performance. Implementation: - Added a `NoCacheSubscopes` option to ScopeOptions for explicit opt-in - Added adaptive behavior that automatically switches to non-caching mode when the number of subscopes exceeds 5000 (HighCardinalityThreshold) - Ephemeral scopes are not stored in the registry and will be garbage collected when no longer referenced - Fixed reporter methods to avoid deadlocks by moving WaitGroup.Done() calls outside of mutex locks - Added tests for both explicit and adaptive ephemeral scope behavior Benefits: - Memory usage plateaus instead of growing unbounded for high-cardinality cases - Reduces lock contention on the scope registry - No breaking changes as this is an opt-in feature - Provides both explicit control and automatic protection Use case: When tags are unique per event (e.g., request IDs or session IDs), this change prevents memory exhaustion while allowing for comprehensive metrics.
|
|
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.
This PR adds optional ephemeral scope handling for high cardinality use cases. This is the first part of a series of changes to improve memory efficiency in high-cardinality metrics scenarios.