cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Collecting all sub-traces for a Trace ID via API

Jan_Lerche
Participant

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?

Trace_ID.png

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.

4 REPLIES 4

Julius_Loman
DynaMight Legend
DynaMight Legend

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.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

rudy_h_0-1708138467843.png

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). 

 

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? 

Services Solution Engineer @PowerCloud - Observability/CloudOps Certified / Former SE @Dynatrace.

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.

Featured Posts