-
Notifications
You must be signed in to change notification settings - Fork 6
Support Related/ActivityId NetTrace output on Linux #206
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
Merged
Conversation
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
The W3C TraceContext is very important for HTTP workloads, we need to support this ideally at an OS level, but also at a per-event basis. We only currently support strings and u64 attributes, for TraceContext and other eventual attributes, we need to be able to store byte arrays. Add new ExportAttributeValue::Record, which stores a record ID that contains bytes with an optional format of those bytes for later decoding. Store TraceId and SpanId attributes at the OS level if they are defined from the underlying sessions (or overrides) as Record attributes. Add methods to create records from ExportTraceContext structs during callbacks, etc. This includes overrides, like we do for other OS attributes. This allows per-event capturing of these details that the OS might not know about. Move default attribute creation from a single function into a list of ExportAttributeSource trait structs. Expose these sources as options in ExportSettings. This allows tools and formats to define what attributes are collected by default for each event. This is useful for formats that do not understand these attributes (or do not have any attribute concepts). For example, stdout formats that never save the actual data. It's not useful to save all this extra data for it to get thrown out at the end. Limit attribute creation exposure by making new_*() within ExportAttributePair to only crate public. This is required because records need more coordination than should be exposed to non-crate code. Expose creating records via ExportMachine to allow non-crate code to create Record attributes if needed instead of at the ExportAttributePair level. This is a much safer design to expose to non-crate code, as we can evolve it vs ExportAttributePair::new_*() methods (that are now only crate visible). Signed-off-by: Beau Belgrave <[email protected]>
Both ActivityId and RelatedActivityId are attributes used on both Windows and Linux by DotNet. We need a way to fetch these automatically as well as override them per-event. Add OS event hooks for ActivityId and RelatedActivityId so we can fetch them consistently. Add ActivityIdAttributeSource for saving these values into samples. Add overrides for ActivityId and RelatedActivityId so we can override them during proxy scenarios within DotNet on Linux. Signed-off-by: Beau Belgrave <[email protected]>
The Linux DotNet IPC will tag events with Related/ActivityId properties, but we didn't have a spot to put them. Now that we have a spot for these, wire them up so they can show up in various formats that understand these attributes. Signed-off-by: Beau Belgrave <[email protected]>
The ExportSettings struct now allows configuration of which attributes to save for all events. Since we support a wide array of formats, we need to enable most of these by default. For now, enable all attributes by default. Eventually the format we pick should decide which of these attributes are needed. Signed-off-by: Beau Belgrave <[email protected]>
The ExportAttributeWalker will gather all the attribute pairs from a given attribute ID within the ExportMachine. When formats only understand certain attributes, we need a way to make it easy to filter them down. Add with_filter() builder pattern to walker. The filter closure returns true if the filter is wanted and false otherwise. This ensures that formats can easily limit attributes to what they expect/support. Add self test to ensure filtering works. Signed-off-by: Beau Belgrave <[email protected]>
Sometimes we need to find the internal ID of a known string without a mutable reference. This is possible, but not exposed via InternedStrings. Add find_id() to InternedSlices and InternedStrings to allow finding item IDs if they exist within the set. Signed-off-by: Beau Belgrave <[email protected]>
We sometimes need to get access to a record's data directly, such as data from attributes that store bytes. Add try_get_record_data() to ExportMachine to ensure we can do this consistently. Signed-off-by: Beau Belgrave <[email protected]>
The ExportMachine now supports record based attributes and those are used for Related/ActivityId GUIDs (16 bytes each). Handle these new attributes by looking for the semantic attribute names "ActivityId" and "RelatedActivityId" for values that are record based. Signed-off-by: Beau Belgrave <[email protected]>
brianrob
approved these changes
Oct 14, 2025
Member
brianrob
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. That was a lot of work!
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.
Updates #203 for Linux half of the Related/ActivityId support, Windows side will come later.