-
Notifications
You must be signed in to change notification settings - Fork 526
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 attribute existence filter #2188
Comments
Hi, I am looking for a way to query that an attribute does not exist for a span, could this be achieved via { !exists(span.att) } or would you propose another method for this? |
Unfortunately this does not currently exist. I want it too, but haven't found the time to add it. Do you have a preferred syntax above? If you know the type of your attribute you can do something like |
For me the second syntax makes the most sense. ( Unfortunately that doesn't work in this case, my only idea for a work around would be to set att="" on span creation as |
I prefer |
I'm putting my money on |
Just making sure I don't miss out on something here...
If we're about to use "nil", "none", or "null" for different meanings here - let me raise a red flag, because it would be confusing and not intuitive for users... Unless I'm missing something - I feel like the |
Great verification.
From what I understand, null value is not allowed for hotel attributes and
it means to suppress the attribute.
I have to read in depth
open-telemetry/opentelemetry-specification#797
…On Thu, May 18, 2023, 10:44 Adir Matzkin ***@***.***> wrote:
Just making sure I don't miss out on something here...
By querying for a value of "nil" for some attribute x (syntax as { span.x
= nil }), we would assume x doesn't even exist?
How would we differentiate between the 2 cases:
1. x is not even a field in a span
2. x *is* a field in a span, but *its value is* None/Null/Nil.
If we're about to use "nil", "none", or "null" for different meanings here
- let me raise a red flag, because it would be confusing and not intuitive
for users...
Unless I'm missing something - I feel like the { exists(span.x) } syntax
would be better here due to the need to differentiate between the above 2
cases.
—
Reply to this email directly, view it on GitHub
<#2188 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADQHK7QPMUG7C5L5D4DD7LXGXOPZANCNFSM6AAAAAAVVOBDHM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Confirmed, otel attributes MUST be non null.
See
https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/common
"Attribute values of null are not valid and attempting to set a null value
is undefined behavior."
With this clarification, I confirm my preference for the `span.x = nil` syntax.
On Thu, May 18, 2023, 11:34 Cyrille Le Clerc ***@***.***>
wrote:
… Great verification.
From what I understand, null value is not allowed for hotel attributes and
it means to suppress the attribute.
I have to read in depth
open-telemetry/opentelemetry-specification#797
On Thu, May 18, 2023, 10:44 Adir Matzkin ***@***.***> wrote:
> Just making sure I don't miss out on something here...
> By querying for a value of "nil" for some attribute x (syntax as {
> span.x = nil }), we would assume x doesn't even exist?
> How would we differentiate between the 2 cases:
>
> 1. x is not even a field in a span
> 2. x *is* a field in a span, but *its value is* None/Null/Nil.
>
> If we're about to use "nil", "none", or "null" for different meanings
> here - let me raise a red flag, because it would be confusing and not
> intuitive for users...
>
> Unless I'm missing something - I feel like the { exists(span.x) } syntax
> would be better here due to the need to differentiate between the above 2
> cases.
>
> —
> Reply to this email directly, view it on GitHub
> <#2188 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AADQHK7QPMUG7C5L5D4DD7LXGXOPZANCNFSM6AAAAAAVVOBDHM>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
Nice, so I did miss something 🙃 , thanks @cyrille-leclerc! If that's the case, and it looks like the first two options Joe mentioned in the original comment are the leading ones, I'd like to help push this feature forward - which means at this point helping out getting to a decision 😃. Here are (IMO) the main considerations we should focus on and take into account when dealing with this kind of syntax question: 1. Expressiveness: Allow users to express a wide range of queries and operations in different query patterns. The more I think about it - I'm getting convinced the
I think that unless the performance parameter is a win for the |
Agree with
|
Adding |
Agree, can't think of a more efficient algorithm and that type of query would always be much slower than |
The output from the work on this issue can be documented with #2188 |
This issue has been automatically marked as stale because it has not had any activity in the past 60 days. |
Is there a way to make a query "if attribute exists, compare to X"? For example, |
Something like this: |
That's unfortunate. The lack of ability to find |
Hi everyone, I discovered a way to achieve this using the existing language and wanted to share it. I think this could be useful if anyone has a pressing need for the functionality today, it's not meant to be a replacement for the better options discussed above. The query is: To explain: We can already pull back an attribute optionally using select(). The span will be populated with the value if it exists. The trick is that those results can be run through another filter to get just the spans that were missing it. The second clause acts like Here's a screenshot using https://github.com/grafana/xk6-client-tracing showing that it works. All of the results are for |
Is your feature request related to a problem? Please describe.
There should be a way to query for the existence of an attribute without asserting a value. Perhaps something like:
Note that the last one overloads querying a boolean attribute for true or false values. If we want to go that route we should think through it carefully.
The text was updated successfully, but these errors were encountered: