-
Notifications
You must be signed in to change notification settings - Fork 530
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
Search query TraceQL is truncated to 1024 characters #3513
Comments
It's pretty fantastic that you are trying to execute a 1024 char+ query. If anyone wants to tackle this it should be fairly straight forward to repro. |
The query is built dynamically by using |
+1
|
Not sure if it is helpful, but it looks like the limit exists only for non-intrinsic fields.
If I send the same to some span.attribute, I get a similar error as above (not the same, though, as I'm using
|
A co-worker and I spent some time last night investigating this further and determined that if you remove the call to We injected some simple code to just Scan() through the scanner in Lex and the full query data > 1024 chars is present if we put the code above the calls to We tested via the
will alleviate the issue as well, leading us to believe the shallow copy is somehow interfering/not a real copy of the the passed in scanner, Could we get any direction/thoughts from you on how this sounds and where to proceed from here? Thank you! |
Thanks for digging in! That scanner copy trick is used in a number of places and was originally stolen from Loki (that doesn't mean it's not an issue). It looks like the scanner has an internal buffer limited to 1024 characters which is likely the cause of our issue. Can you post a test which exposes the problem? With a little debugging I could probably get a better understanding. |
Not a test, but hopefully this rough proof of concept demonstrates what we're thinking... forgive me if this isn't an accurate reproduction of what I think is happening in the
If you run the above, and the Let me know what you think, thanks! |
Welcome to go :) So I can confirm by debugging that the copy works correctly and the original scanner is not impacted by the forward seek looking for a matching scope. See linked fix. I've added code that causes the scope search to quit as soon as it comes across any non attribute rune and this passes all tests including a new one that exposed the issue. However, I still haven't found the exact mechanic that was causing the issue. |
This also occurs when the attribute name is > 1024 chars. Fixed with aa5bf9f |
Fix merged! Thx for all the help 🙏 |
For a query longer than 1024 characters, Tempo will return an error:
(where
<N>
is the length of query >1024)To Reproduce
Steps to reproduce the behavior:
Expected behavior
Any query works.
Environment:
docker
Additional Context
Whole query is printed in the logs, so that means the parsing step truncates it to 1024 characters (or just stops after that number).
tempo/modules/frontend/search_handlers.go
Line 85 in 3d2850d
tempo/pkg/api/http.go
Line 147 in 3d2850d
tempo/pkg/traceql/parse.go
Line 40 in 3d2850d
tempo/pkg/traceql/expr.y.go
Line 643 in 3d2850d
As I can see, the
goyacc
package is used. I'm not an expert on this, but I think there should be a way to configure the parsing limits, so that they can be exposed in Tempo's config.The text was updated successfully, but these errors were encountered: