Fix OTel review comments: typo, IDisposable, deduplicate completed co…#7510
Merged
Evangelink merged 2 commits intomainfrom Mar 9, 2026
Merged
Fix OTel review comments: typo, IDisposable, deduplicate completed co…#7510Evangelink merged 2 commits intomainfrom
Evangelink merged 2 commits intomainfrom
Conversation
…unter, add tests - Fix typo: _totalUnknownedTests -> _totalUnknownTests - Implement IDisposable on OpenTelemetryResultHandler to clean up orphaned activities - Make TestApplicationResult implement IDisposable to forward disposal - Move _totalCompletedTests.Add(1) into HandleTestResult to deduplicate - Add 19 unit tests for OpenTelemetryResultHandler covering all Notify methods, activity lifecycle, tag setting, disposal, and edge cases
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Microsoft.Testing.Platform’s OpenTelemetry result handling to address review feedback by fixing a typo, ensuring OTel activities are cleaned up via IDisposable, and improving counter accounting; adds unit tests to cover the handler’s notify paths and activity lifecycle.
Changes:
- Rename
_totalUnknownedTeststo_totalUnknownTests. - Implement
IDisposableonOpenTelemetryResultHandlerand forward disposal fromTestApplicationResultto clean up orphaned activities. - Deduplicate completed-test counting by moving
_totalCompletedTests.Add(1)intoHandleTestResult, and add comprehensive unit tests for the handler.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/UnitTests/Microsoft.Testing.Platform.UnitTests/Telemetry/OpenTelemetryResultHandlerTests.cs | Adds unit tests covering notify methods, activity tagging/disposal, and edge cases. |
| src/Platform/Microsoft.Testing.Platform/Telemetry/OpenTelemetryResultHandler.cs | Fixes counter field typo, adds IDisposable to dispose orphaned activities, and deduplicates completed counter updates. |
| src/Platform/Microsoft.Testing.Platform/Services/TestApplicationResult.cs | Implements IDisposable to dispose the OTel result handler during shutdown. |
Youssef1313
approved these changes
Mar 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.
…unter, add tests