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] TraceQL: documentation to filter traces where a span attribute exists #2465

Closed
cyrille-leclerc opened this issue May 11, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request stale Used for stale issues / PRs type/docs Improvements or additions to documentation

Comments

@cyrille-leclerc
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When troubleshooting my application, I would like to search for traces having a specific attribute being defined.
For example, for the operation getProduct, I want to find traces containing SQL spans, traces that contain a span with an attribute db.type.

I want to write this query without having to know what are the possible values for db.type, just saying that the attribute db.type is defined.

When using ElasticSearch & Kibana, it's the syntax my_field: * where * means "exist in any form".
I would like the TraceQL docs to document how I can do the equivalent with Tempo.

cc @knylander-grafana

@cyrille-leclerc cyrille-leclerc added type/docs Improvements or additions to documentation enhancement New feature or request labels May 11, 2023
@faustodavid
Copy link
Contributor

Hi @cyrille-leclerc, you can specify in your TraceQL that an attribute need to have value.

The following query will return all spans that have the attribute db.type defined:

{span.db.type!=""}

@joe-elliott
Copy link
Member

This is a great tip but not entirely true. This will return any spans that have a string attribute named span.db.type that has a value besides "".

{span.db.type!=""}

Due to the way we assert types there is no way to see if an attribute of any type exists. We have an issue here:

#2188

I favor

{ span.db.type != nil }

but others have expressed they like:

{ exists(span.db.type) }

@faustodavid
Copy link
Contributor

Indeed, { span.db.type != nil } looks more intuitive.

@knylander-grafana
Copy link
Contributor

knylander-grafana commented Jul 8, 2023

@joe-elliott From what you said above, it sounds like the solution to be able to complete what Cyrille wants to do depends upon #2188. I'll add a note to your issue in progress that #2465 creates documentation for #2188. I can use Cyrille's question in the description as an example in the documentation.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

This issue has been automatically marked as stale because it has not had any activity in the past 60 days.
The next time this stale check runs, the stale label will be removed if there is new activity. The issue will be closed after 15 days if there is no new activity.
Please apply keepalive label to exempt this Issue.

@github-actions github-actions bot added the stale Used for stale issues / PRs label Sep 7, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Used for stale issues / PRs type/docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants