TraceQL structural operator how to combine/select fields from e.g. parent #4313
Unanswered
WizzardMaker
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi @WizzardMaker. What visualization are you using: explore or a table panel? With a union structural operator and selecting |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We want to aggregate run time metrics of LLM calls in an application with categorized searches.
Each LLM call has a span associated with all its metrics and that span is a child of a "category" span (with other child spans as well)
Now the category span has an attribute which we want as "group by" key for the aggregation, and a single trace contains multiple category spans.
Problem is, that we don't really see a performant/easy way to get the tag from the parent span in a child query
The query looks something like this:
But that won't get us the span.tag of the parent
A way that could work would be to use a union structural, but parent and child would need to have a common value to aggregate them later with e.g. Grafana transformations. We couldn't find any attribute that "links" both together.
![image](https://private-user-images.githubusercontent.com/7768485/385006407-89acbebe-12d1-4fc5-b697-9a1a1b4846f5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODQ4ODcsIm5iZiI6MTczOTI4NDU4NywicGF0aCI6Ii83NzY4NDg1LzM4NTAwNjQwNy04OWFjYmViZS0xMmQxLTRmYzUtYjY5Ny05YTFhMWI0ODQ2ZjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMTQzNjI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTI3MDFhODNiNTgxZGY2Mzk2N2VhMDJmYzQ1YzU0MDljZDMyZDRiMWEzYjA4MDBjYTYxYjVmNWMwNjc1MzUxOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.zjxPdhyTDTUivDiqeH43IkNss91PLTEe9_03RnXnT2Q)
Example result for a union looks like this (there are more rows in the result than in the image):
Our goal is to have a query that results in a single row combining parent-child
What would be the best way to accomplish a true "union" of parent and child span attributes in the same result row?
Beta Was this translation helpful? Give feedback.
All reactions