fix: Applied Dispose Pattern to Prevent Resource Leaks#5893
Closed
chiomalovet wants to merge 1 commit intoopen-telemetry:mainfrom
Closed
fix: Applied Dispose Pattern to Prevent Resource Leaks#5893chiomalovet wants to merge 1 commit intoopen-telemetry:mainfrom
chiomalovet wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
The committers listed above are authorized under a signed CLA. |
Member
|
This looks like a spam PR from bots. |
This was referenced Oct 9, 2024
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.
Here's a detailed pull request description based on the template you've provided:
Fixes
Closes (#5140)
Design Discussion Issue
This pull request addresses the design discussion in # regarding the use of the dispose pattern for proper resource management in the codebase.
Changes
The following changes were made:
Implemented Dispose Pattern: Applied the dispose pattern to ensure proper cleanup of resources. The tracerProvider.Dispose() is now explicitly called to flush spans and shut down the tracing pipeline, avoiding resource leaks.
Removed Implicit Disposal: Eliminated the pattern of "using var" for meterProvider in favor of explicitly calling Dispose(). This resolves the potential issue where helper methods could inadvertently cause premature disposal of the provider.
Ensured Consistency: The changes align with best practices for resource management in .NET and provide clarity to future contributors copying code patterns.
Merge Requirement Checklist:
CONTRIBUTING Guidelines Followed: License requirements met, static analysis tools were run, and nullability is enabled where appropriate.
Unit Tests Added/Updated: Relevant tests were reviewed and updated where necessary to ensure the changes function as expected.
CHANGELOG.md Updated: The CHANGELOG.md has been updated to reflect these non-trivial changes to resource management.
Changes in Public API Reviewed: No breaking changes were introduced to the public API. The dispose pattern change does not affect the external API contract but ensures better internal resource management.