apm-agent-dotnet icon indicating copy to clipboard operation
apm-agent-dotnet copied to clipboard

Make internal fields on DistributedTracingData public

Open monty241 opened this issue 7 months ago • 0 comments

When self-handling traceparent, the use case we came across is the need to compare the transaction settings in Agent.Tracer.CurrentTransaction with the value of the traceparent HTTP header. The traceparent can be deserialized (and checked) using TryDeserializeFromString, but the members are internal only.

The use case is to use a generic class (filter) to more complex logic whether to create a new transaction when running distributed or hook on to the current transaction. Remember when service names are different, a new transaction can be attached to the parent span, whereas with equal service names this is not possible.

It would make it easier to compare TraceId, ParentId and TraceState between the current transaction and traceparent using the deserialized version acquired as an instance of DistributedTracingData when these fields would be readonly public.

Workaround is compare the string of traceparent and assume validity when TryDeserializeFromString returns a non null value.

monty241 avatar Jul 01 '24 19:07 monty241