Can I create a TraceQL query that filters based on referenced linked spans? #3656
-
We run a event-based microservice system in which we'd want to be able to query traces based on the attributes of a trace from another system. According to the OTEL semantic conventions for distributed traces the traces from each microservice are linked to each other with a referenced linked span. In Grafana this is visually displayed quite nicely. Now it would be nice to be able to query Tempo to find all traces that are referenced from a trace with a certain name/attributes. I thought that this would be possible with the structural operators but I can't see any operator for referenced spans. Currently finding all traces that were initiated from one action requires how the systems interact, for each possible action. This doesn't really scale with an increasing number of microservices and async interactions. Following examples are things that I'd like to be able to do: Finding the source trace of a trace.
Finding the absolute origin of a chain of traces.
Finding all spans that are "spawned" from a trace.
This last one is probably impossible to achieve in a performance-optimal way, considering that the spans only reference eachother in the opposite direction. However for our usecase the time-performance isn't that relevant tbh. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
We do have some plans to support links detailed here, but they do not include structural operators "through" the link. It would be quite difficult to achieve this b/c a linked span would require doing a full search of the database for the trace id. I'm not sure how to do it efficiently. |
Beta Was this translation helpful? Give feedback.
-
Hey - is there any update on this atm? |
Beta Was this translation helpful? Give feedback.
For an update here: the proposed link syntax is currently in development. Also, TraceQL now supports
trace:id
andspan:id
intrinsics.The discussed analysis could be done using a script that used the links span/trace ids to create a new query like:
{ trace:id = "foo" && span:id = "bar" } >> { <whatever conditions i care about> }
this is close to what tempo would have to do internally anyway.