-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pkg/ottl] Improve OTTL parser error reporting (open-telemetry#23840)
**Description:** I was playing with an erroneous config like the following and noticed that the error reporting was confusing: ```yaml processors: filter: metrics: metric: - true - false ``` This PR updates the error messages to print the statements next to the error so it's clear which statement caused the error. To speed up feedback cycles when changing multiple statements, I've also configured the parser to attempt to parse each statement so users can see all errors at once. Errors now look like this: ``` Error: invalid configuration: processors::filter: unable to parse OTTL statement "drop() where 1": statement has invalid syntax: 1:15: unexpected token "<EOF>" (expected <opcomparison> Value); unable to parse OTTL statement "drop() where 0": statement has invalid syntax: 1:15: unexpected token "<EOF>" (expected <opcomparison> Value) ``` **Testing:** Unit test Co-authored-by: Evan Bradley <evan-bradley@users.noreply.github.com>
- Loading branch information
1 parent
7239c4a
commit a0883a0
Showing
7 changed files
with
92 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
# If your change doesn't affect end users, such as a test fix or a tooling change, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: pkg/ottl | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Improve error reporting for errors during statement parsing | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [23840] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | | ||
- Failures are now printed for all statements within a context, and the statements are printed next to the errors. | ||
- Erroneous values found during parsing are now quoted in error logs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters