14 Apr 2023 12:56 PM - last edited on 17 Apr 2023 09:57 AM by MaciejNeumann
Hello Dynatrace community
I'm looking for a solution for the following problem. It consists of two parts.
1st: How can I get the Trace ID of a record that I can identify via Dynatrace API?
2nd: If it is possible to get this information via API, how can I get all Span IDs (or other attributes) of the spans that are sharing the same Trace ID?
Background: If several calls are content of a single distributed trace, all of them create an own span but share one trace ID. Further there is a relationship between called service and caller, that is mentioned as Parent span ID in the Dynatrace UI. The initial span doesn't have a parent. If want to collect this data via API like the UI does, I need these relationships.
Solved! Go to Solution.
15 Apr 2023 08:51 AM
Collected distributed trace data is not exposed via API, so the answer is - you cannot. At least not for a single Trace or list of traces.
The closest approach I can think of would be using just the monitored entities API and using the relationsips between entities and use filters where possible, but you get just the "service flow" data - relations ships between services and not individual requests.
17 Feb 2024 03:02 AM
Can we get Span ID from the Service A using a Oneagent extension in the Middleware? After that I would like to create spans that will be part of Service A Span ID from the Oneagent extension. I would like to trace ISO 8583 message (non HTTP message).
17 Feb 2024 03:20 AM - edited 17 Feb 2024 03:27 AM
Span/Trace id data is not exposed via API.. yet. When Purepath/trace data in Grail is GA you will be able to get that information. Then is passing the query via api.
I would assume that you want to create context on the fly. And wait until the trace is processed it could take some time, even if those are ms.
Why not use Otel and do a context propagation of the trace_id and parent_id of the previous one? Or you don't have access to the code?
17 Feb 2024 06:08 AM
Exactly, I don't have access to the code. But I may create the context in the ISO 8583 message but not in http header. Otel is great but I am not sure when this switch will support Otel in the future.