Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TraceQL: Support Parent and Ancestor structural operators #2670

Closed
joe-elliott opened this issue Jul 18, 2023 · 3 comments · Fixed by #2877
Closed

TraceQL: Support Parent and Ancestor structural operators #2670

joe-elliott opened this issue Jul 18, 2023 · 3 comments · Fixed by #2877
Assignees
Labels
enhancement New feature or request traceql

Comments

@joe-elliott
Copy link
Member

joe-elliott commented Jul 18, 2023

Currently TraceQL supports descendant >> and child > operators. These operators are evaluated on two spansets and return the spans from the right hand side. i.e. { span.http.target = "/customers" } >> { status = error } returns spans with the error status below the span.http.target endpoint.

However, it might be useful to find all /customer spans that have errors somewhere beneath them. This is not possible with the current operators but could be acheived using something like:

{ status = error } << { span.http.target = "/customers" }

By reversing the operator we keep the behavior that structural operators always return spans from the right hand side. We also retain the meaning of the direction of the arrow and count of arrows.

Ancestor:

{} << {}

Parent

{} < {}
@joe-elliott joe-elliott added enhancement New feature or request traceql labels Jul 18, 2023
@09jvilla
Copy link
Contributor

To clarify the example...

{ status = error } << { span.http.target = "/customers" }

This will match the same set of traces as

{ span.http.target = "/customers" } >> { status = error }

But the span set for those matched traces would be different? In the first case, the span set would be spans with { span.http.target = "/customers" } and in the second case, the span set would be spans with { status = error }?

@joe-elliott
Copy link
Member Author

Yes. In all structural operator cases we are returning spans from the RHS only for consistency. Your example is correct.

@kousikmitra
Copy link
Contributor

I am working on this, please let me know if anyone else has picked it up.

kousikmitra added a commit to kousikmitra/tempo that referenced this issue Aug 31, 2023
kousikmitra added a commit to kousikmitra/tempo that referenced this issue Aug 31, 2023
mdisibio pushed a commit that referenced this issue Sep 5, 2023
* Add tracql support for ancestor and parent operator #2670

* Add ast evaluation logic

* Add changelog entry

* Add doc entry

* Fix ancestor condition extraction

* Add column lookups based on ancestor and parent field

* Remove ancestor and parent intrinsic fields

* Fix doc

* Remove comment change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request traceql
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants