We have DiagnosticSourceEventSource which enables listening to Activity \ traces out of process.
DiagnosticSourceEventSource supports an argument FilterAndPayloadSpecs which can be used to configure the events and payload which will be written to the source. Example:
[AS]MyActivitySource/Stop:-TraceId;SpanId;ParentSpanId;ActivityTraceFlags;Kind;DisplayName;StartTimeTicks=StartTimeUtc.Ticks;DurationTicks=Duration.Ticks;Status;StatusDescription;Tags=TagObjects.*Enumerate;ActivitySourceVersion=Source.Version
Tags=TagObjects.*Enumerate; works for retrieving tags.
But this...
Events=Events.*Enumerate;Links=Links.*Enumerate;
...won't work for retrieving Events and/or Links.
The reason it doesn't work is ActivityEvent and ActivityLink structs don't provide a suitable ToString implementation which is how the data gets serialized:
-
|
return string.Join(",", (IEnumerable<ElementType>)obj); |
-
|
result.Append(currentValue.ToString()); |
The solution could be to implement more useful ToString operations or provide some other way to include that data via the FilterAndPayloadSpecs. ToString could be tricky for ActivityEvent because it contains its own tag collection.
/cc @noahfalk @tarekgh @samsp-msft
We have DiagnosticSourceEventSource which enables listening to
Activity\ traces out of process.DiagnosticSourceEventSourcesupports an argumentFilterAndPayloadSpecswhich can be used to configure the events and payload which will be written to the source. Example:Tags=TagObjects.*Enumerate;works for retrieving tags.But this...
Events=Events.*Enumerate;Links=Links.*Enumerate;...won't work for retrieving Events and/or Links.
The reason it doesn't work is
ActivityEventandActivityLinkstructs don't provide a suitableToStringimplementation which is how the data gets serialized:runtime/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
Line 1526 in 26a1e72
runtime/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
Line 1494 in 26a1e72
The solution could be to implement more useful
ToStringoperations or provide some other way to include that data via theFilterAndPayloadSpecs.ToStringcould be tricky forActivityEventbecause it contains its own tag collection./cc @noahfalk @tarekgh @samsp-msft