Skip to content

fix: Applied Dispose Pattern to Prevent Resource Leaks#5893

Closed
chiomalovet wants to merge 1 commit intoopen-telemetry:mainfrom
chiomalovet:fix-dispose-pattern
Closed

fix: Applied Dispose Pattern to Prevent Resource Leaks#5893
chiomalovet wants to merge 1 commit intoopen-telemetry:mainfrom
chiomalovet:fix-dispose-pattern

Conversation

@chiomalovet
Copy link

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.

@chiomalovet chiomalovet requested a review from a team as a code owner October 9, 2024 14:12
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 9, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the documentation Documentation related label Oct 9, 2024
@reyang
Copy link
Member

reyang commented Oct 9, 2024

This looks like a spam PR from bots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants