Skip to content

[IPC Protocol] Add specification to configure a user_events eventpipe session #5454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mdh1418
Copy link
Member

@mdh1418 mdh1418 commented Apr 21, 2025

In .NET 10, the EventPipe infrastructure will be leveraged to support user_events.

This PR documents the protocol for enabling a user_events-based EventPipe Session through the Diagnostics IPC protocol, where a new EventPipe Command ID CollectTracing5 will accept necessary tracepoint configuration.

As the user_events EventPipe session is not streaming based, the payload is expected to first encode a uint output_format to denote the session format (streaming vs user_events). Afterwards, only relevant session configuration options are to be encoded, outlined at the top of the EventPipe Commands section in the Streaming Session section, User_events Session section, and Session Providers section.

For user_events EventPipe sessions, an additional tracepoint_config is to be encoded, to map Event IDs to tracepoints.
This protocol expects the Client to have access to the user_events_data file in order to enable configuring a user_event EventPipe session, and expects the SCM_RIGHTS to the user_events_data file descriptor to be sent in the continuation stream.

Additionally, as user_events does not support callbacks, a new event_filter config is expected to be encoded in CollectTracing5, to act as an allow/deny list of Event IDs that will apply post keyword/level filter.

@mdh1418 mdh1418 requested a review from a team as a code owner April 21, 2025 23:53
@mdh1418 mdh1418 force-pushed the add_ipc_message_protocol_for_user_events_ep_session branch from 722afa6 to 4094fe9 Compare April 21, 2025 23:54
* `uint format`: 0 for the legacy NetPerf format and 1 for the NetTrace V4 format
* `ulong rundownKeyword`: Indicates the keyword for the rundown provider
* `bool requestStackwalk`: Indicates whether stacktrace information should be recorded.
* `int output_format`: 0 for streaming, 1 for writing to `user_events` tracepoints specified by `provider_config`

Choose a reason for hiding this comment

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

We need to document the format of the user_event payload as well. Unsure if it should be here directly or a link, but needs to be documented.

mdh1418 added 2 commits April 25, 2025 12:19
Update CommandSets Command IDs
Move EventPipe StopTracing to beginning
Fix sample payload serialization
Clarify Header Size and NetTrace format version
Clarify that filter_data can be 0 length to avoid confusion with
optional meaning that encoding can be skipped
@mdh1418 mdh1418 force-pushed the add_ipc_message_protocol_for_user_events_ep_session branch from c30b773 to 8b5bf46 Compare April 25, 2025 16:26
@mdh1418 mdh1418 force-pushed the add_ipc_message_protocol_for_user_events_ep_session branch from 1ba9499 to 87902f0 Compare May 1, 2025 00:56
@mdh1418 mdh1418 requested a review from brianrob May 6, 2025 14:46

Once the runtime has received the configured tracepoint names as detailed under [tracepoint_config](#user_events-session-payload), it uses the [file descriptor passed in the continuation stream](#passing_file_descriptor) to register the prescribed tracepoint names following the [user_events registering protocol](https://docs.kernel.org/trace/user_events.html#registering). The runtime will construct a `user_reg` struct for every tracepoint name, defaulting to using none of the `user_reg` flags, so the resulting command format will be as follows:

`<tracepoint_name> u16 event_id; __rel_loc char[] payload; __rel_loc char[] meta`

Choose a reason for hiding this comment

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

I'm wondering if we should use u8[] vs char[] for payload and meta given the offline conversation we had around implicit string decoding types. That would make it more clear that these payloads are binary vs strings for some decoding tools. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

u8[] makes sense to me

@mdh1418 mdh1418 requested a review from agocke May 6, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants