24 Nov 2020 10:50 AM - last edited on 04 Sep 2023 10:18 AM by MaciejNeumann
Hello,
I have noticed that the tracestate is not used by dynaytrace, is this a deliberate design choice or will the X-dynatrace header be placed there in the future?
Also when both traceparent and x-Dynatrace are available, what is the preference to stitch pp? And what happens if both contradict?
KR Henk
Solved! Go to Solution.
24 Nov 2020 11:47 AM
At the moment it's used for stitching transactions on the boundaries of services monitored by Dynatrace OneAgents. The X-Dynatrace header is used within a Dynatrace environment only. If you need to follow PurePaths from one Dynatrace environment to another one, the W3C tracing headers are used.
So within an environment, the X-Dynatrace does have a higher priority at the moment.
25 Apr 2021 07:12 PM - edited 25 Apr 2021 07:15 PM
Hi @Julius_Loman , I hope you're doing well. I've a question.
The W3C Trace Context defines the traceparent and tracestate headers. In the traceparent header there are the trace-id and the parent-id. The parent-id is the span-id of the sender (the previous service), right?
So, how can we get the current span-id (I mean, the span-id of the current service)?
With the trace-id, the current span-id and the parent-id we can correlate all the logs (for example). But only with the trace-id and the parent-id, we can't.
Additional info: some tracing SDK, like OpenTelemetry, allows accessing to the Span Context, where the new span-id is. But I don't know how to extract that span-id when the services is traced by the One Agent.
Thanks a lot!
25 Apr 2021 08:00 PM
@luis_mpa , can you please describe what problem are you trying to solve?
26 Apr 2021 01:07 PM
Yes, of course.
The use case is the following: suppose you have a sequence like the attached picture 1. The W3C Trace Context indicates that the span-id of the current service should be sent as parent-id. So, when the other service receives the request, it generates its own span-id -which is put in a span context- and all the log traces that the service generates for that span can be correlated (picture number 2), because you have the trace-id, the parent-id (which is the span id of the caller) and the span-id of the current microservice.
In the following entry the use case is explained with full detail --> https://sgryphon.wordpress.com/2020/11/16/a-guide-to-w3c-trace-context/ (the key point is the "Log messages title". You can find it by scrolling the page).
The key is that the requested service is which generates it owns span-id. In our case, since the One Agent is monitoring and tracing that service, is the One Agent -I suppose, please confirm- which generates the spanId. But I don't know how to extract that spanId, in order to use for logging output (like the picture 2 indicates).
Regards!