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: Constructions without conditions can return nothing #2498

Closed
joe-elliott opened this issue May 23, 2023 · 2 comments · Fixed by #2930
Closed

TraceQL: Constructions without conditions can return nothing #2498

joe-elliott opened this issue May 23, 2023 · 2 comments · Fixed by #2930
Labels
keepalive Label to exempt Issues / PRs from stale workflow traceql type/bug Something isn't working

Comments

@joe-elliott
Copy link
Member

joe-elliott commented May 23, 2023

Describe the bug
The following TraceQL query returns nothing:

{} | by(span.does_not_exist)

Whereas this query returns grouped spans by(span.does_not_exist) = nil

{ span.does_exist = <value that exists> } | by(span.does_not_exist)

The reason is that b/c when the engine creates conditions for the fetch layer in the first example it only creates one condition which asks for the attribute name does_not_exist with the operation OpNone. The fetch layer interprets OpNone more like OpExists and returns nothing. We need the fetch layer to interpret OpNone as simply "fetch" and add a new operation OpExists.

Current workaround would be to put a known existing attribute into the conditions. Something like:

{ resource.service.name != "" } | by(span.does_not_exist)
@joe-elliott joe-elliott added type/bug Something isn't working traceql labels May 23, 2023
@joe-elliott
Copy link
Member Author

joe-elliott commented May 25, 2023

This also occurs on the following query:

{} || { span.does_not_exist }

Humorously this bug allows for searching for attribute existence which is a feature request. The above query will return every span where the attribute span.does_not_exist exists regardless of it's value.

@github-actions
Copy link
Contributor

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 Jul 25, 2023
@joe-elliott joe-elliott added keepalive Label to exempt Issues / PRs from stale workflow and removed stale Used for stale issues / PRs labels Jul 25, 2023
@mdisibio mdisibio mentioned this issue Sep 13, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive Label to exempt Issues / PRs from stale workflow traceql type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant