Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@beaubelgrave
Copy link
Collaborator

Updates #203 for Linux half of the Related/ActivityId support, Windows side will come later.

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]>
@beaubelgrave beaubelgrave self-assigned this Oct 14, 2025
@beaubelgrave beaubelgrave requested a review from brianrob October 14, 2025 19:26
Copy link
Member

@brianrob brianrob left a 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!

@beaubelgrave beaubelgrave merged commit d67a059 into main Oct 14, 2025
12 checks passed
@beaubelgrave beaubelgrave deleted the users/beaub/activity_id branch October 14, 2025 23:44
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