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

[DOC] Add documentation and examples for nestedSetLeft/Right/Parent #4516

Open
knylander-grafana opened this issue Jan 6, 2025 · 2 comments
Labels
traceql type/docs Improvements or additions to documentation

Comments

@knylander-grafana
Copy link
Contributor

knylander-grafana commented Jan 6, 2025

Update the TraceQL documentation to include nestedSetLeft/Right/Parent in the Intrinsics section: https://grafana.com/docs/tempo/next/traceql/#selecting-spans

This capability was added in the 2.5 release.

Provide examples of usage.

Questions to answer:

  • What is the use case for when this intrinsic would be good in a query?
  • Why would someone use this? (use case/benefit)
  • What are some basic and more complicated examples that show a real-world use case?
@knylander-grafana knylander-grafana added type/docs Improvements or additions to documentation traceql labels Jan 6, 2025
@knylander-grafana knylander-grafana moved this to Todo in Tempo squad Jan 7, 2025
@louislepper
Copy link

A key use case that I'm looking for (not yet sure if TraceQL intrinsics will do this for me) is:

Root Span -> ... various spans ... -> Service A span with userId attribute -> ... various spans .. -> Service B -> Service B inner span -> Other spans...

Service B inner span could be a particularly slow or expensive method, for example.

I want to get a list of all users who hit "Service A span" who also hit "Service B inner span".
The ideal output would look like:
UserId | Count
1234 | 2000
5678 | 5
...

The count should not include times that "service B inner span" was hit not via "Service A span".

Thanks

@mapno
Copy link
Member

mapno commented Jan 13, 2025

Are you familiar with structural operators? They should cover most of what you're trying to do.

Root Span -> ... various spans ... -> Service A span with userId attribute -> ... various spans .. -> Service B -> Service B inner span -> Other spans...

{ nestedSetLeft<0} >> { resource.service.name = "service-a" } >> { resource.service.name = "service-b" } > { resource.service.name = "service-b" && kind = internal } > { .foo = "bar" }

A query like the above should get you that. Depending on the specifics of your traces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
traceql type/docs Improvements or additions to documentation
Projects
Status: Todo
Development

No branches or pull requests

3 participants