-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[pkg/ottl] Refactor grammar validation to use the AST visitor and combining errors #35728
[pkg/ottl] Refactor grammar validation to use the AST visitor and combining errors #35728
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edmocosta can you share what an user would see now if they pass in a statement that fails multiple errors?
Users would see errors separated by line breaks, for example:
Another option would be wrapping it using the
|
Thanks for investigating the alternative. We're trying to move to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
Co-authored-by: Evan Bradley <[email protected]>
Is there any way to do single line with errors.Join? Including |
Enabling JSON encoding should escape the new lines and put them inside the log body, right? I don't mind it if they're encoded, but if they split a JSON log then I agree it's an issue. |
I might be wrong but I think it's not possible to do that using only the |
Any solution that puts them in the same log line works for me - I really really don't want to write separate lines - I can't think of another place in the collector that writes multiple-line logs. |
@TylerHelmuth, @evan-bradley, I've addressed the message format suggestion at 49b63e3, it now prints the messages separated by semicolons instead of line breakers:
Thank you! |
Description
This PR is a follow up of #35174 (comment), and replaces the grammar's
checkForCustomError
mechanism by a newottl.grammarVisitor
implementationgrammarCustomErrorsVisitor
.Differently of the current
checkForCustomError
, it joins and displays all errors at once instead of one by one, IMO, it's specially useful for statements with more than one error, for example:set(name, int(2), float(1)).
.The parsing tests were also modified to ensure the error captured is in fact the one expected by the failing statement/condition.
Testing
Unit tests