Skip to content

EventSource does not write all events to EventPipe - #35334

Merged
davmason merged 4 commits into
dotnet:masterfrom
davmason:eventsource_fixes
Apr 28, 2020
Merged

davmason merged 4 commits into
dotnet:masterfrom
davmason:eventsource_fixes

Conversation

@davmason

Copy link
Copy Markdown
Contributor

Currently if an EventPipe session is enabled but an etw session is not, EventSource will not write any events that go through WriteEventRaw to EventPipe. The first line checks if m_etwProvider is null and bails if it is, so it never gets to the EventPipe call.

We also don't write any error messages through ReportOutOfBandMessage to EventPipe

@davmason
davmason requested review from a team, josalem and noahfalk April 23, 2020 11:11
@davmason davmason self-assigned this Apr 23, 2020
@ghost

ghost commented Apr 23, 2020

Copy link
Copy Markdown

Tagging subscribers to this area: @tommcdon
Notify danmosemsft if you want to be subscribed.

@davmason

Copy link
Copy Markdown
Contributor Author

The WriteEventString still doesn't actually write to EventPipe even with this change. I suspect it's because the EventSource is never enabled so it bails in EventPipe::WriteEvent. I need to investigate a little more.

@davmason

Copy link
Copy Markdown
Contributor Author

Ok, with the latest commit I have it so that if EventSource runs in to an error during creating of the manifest it will log the error to EventPipe.

It turned in to a bigger rabbit hole than expected, the issue is that WriteEventString tries to write an event without any metadata, and the native EventPipe stuff expects metadata for everything. I looked at making the native side take an event without metadata but it would touch a ton of files and add a ton of logic. Instead, I went with the approach that if EventSource calls WriteEventString then it will create a custom event to write to EventPipe with id=0.

@sywhang sywhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David! Can we add a test for WriteEventString and consuming it via EventPipe as part of this PR?

@davmason

Copy link
Copy Markdown
Contributor Author

@sywhang Sure, I just added a test

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation direction makes me a little nervous. More thoughts inline and happy to chat on it anytime. Thanks David!

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@davmason
davmason force-pushed the eventsource_fixes branch from bd30137 to a3b30af Compare April 27, 2020 23:29
@davmason
davmason merged commit 167e81b into dotnet:master Apr 28, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
@davmason
davmason deleted the eventsource_fixes branch January 20, 2021 09:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants