Initialize EventPipe tracee logging before collection - #6028
Merged
max-charlamb merged 2 commits intoSep 15, 2026
Merged
max-charlamb merged 2 commits into
max-charlamb merged 2 commits into
Conversation
Match expected log records by message instead of assuming global ordering across EventPipe producer threads, and re-enable the previously skipped coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d5c60f7-9c89-42e6-b9fc-04ef78c8f8d8
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain, and the tests retain full validation.
Pull request overview
Updates EventLogs tests to validate records independently of cross-thread delivery order.
Changes:
- Matches records by message identity.
- Preserves exact count and metadata validation.
- Re-enables previously skipped tests.
File summaries
| File | Description |
|---|---|
src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs |
Makes EventLogs assertions order-independent and re-enables skipped tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Construct the tracee logger factory before signaling readiness so EventPipe filter updates cannot race options-monitor initialization and drop the initial log records. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d5c60f7-9c89-42e6-b9fc-04ef78c8f8d8
mdh1418
approved these changes
Sep 14, 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
Root cause
The tracee connected its readiness pipe before constructing
ILoggerFactory. The parent treats that connection as permission to enable EventPipe. If the EventPipe filter update raced logger-factory initialization, the options monitor could miss the change notification and retain the application filters (Errorby default andWarningforAppLoggerCategory). This dropped the threeLoggerRemoteTestrecords and the app Information record, leaving exactly the app Warning and Error records.The original tests reproduced this locally:
LogsPipelineUnitTestsreceived 2 of 5 records after 45 iterations, andEventLogsPipelineUnitTestssubsequently observedWarning message.where the first custom Information record was expected. TraceEvent already merges EventPipe events by timestamp, so the failure was missing events rather than a lack of consumer-side sorting.Testing
EventPipeTraceefor .NET 8, 9, 10, and 11EventLogsPipelineUnitTestsandLogsPipelineUnitTests100 consecutive timesFixes #2541
Fixes #5659