Tweak traceql parsing to correctly parse binary operations without space #1941
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does:
This PR changes parsing of most binary operations to work without spacing. Example:
{.foo="bar"}
. Previously this wasn't handled as expected and the entirefoo="bar"
was considered the attribute name. This was done purposefully to accommodate searching on attribute names with syntaxy characters like= ~ - +
etc, but the negative impact to every day usage isn't worth it.Characters in the changed operations can no longer be included in an attribute name so querying on them is impossible. Some operations are not changed because the likelihood of those characters in attribute names is enough to weigh the decision the other way.
Fixed:
= != =~ != > >= < <= ^ && ||
Unchanged:
+ - / % *
Overall
Currently this isn't in a good spot because we are trading parsing flexibility for attribute name support. TraceQL needs some escape hatches to support the full range of valid attribute names which is any valid unicode sequence and could include things like newline, space, quotes, etc. There's no way to unambiguously fit this into the current language spec.
Which issue(s) this PR fixes:
Fixes #1939
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]