Fix unexpected behavior interpreting matchers in amtool#3386
Closed
grobinson-grafana wants to merge 1 commit intoprometheus:mainfrom
Closed
Fix unexpected behavior interpreting matchers in amtool#3386grobinson-grafana wants to merge 1 commit intoprometheus:mainfrom
grobinson-grafana wants to merge 1 commit intoprometheus:mainfrom
Conversation
|
|
||
| "github.com/alecthomas/kingpin/v2" | ||
| "github.com/go-openapi/strfmt" | ||
| new_matchers "github.com/grobinson-grafana/matchers" |
Collaborator
Author
There was a problem hiding this comment.
I've imported this package to demonstrate how this fix will work, however in the finished pull request it will use the code from #3353.
This commit fixes some of the unexpected behavior when interpreting
matchers in amtool.
Before this commit, <matcher-groups> that looked like a valid matcher
such as {foo=bar} would have "alertname" prefixed as amtool considered
it to be a label value. However, this would create a silence for
alertname="{foo=bar}" which is almost never want the user intended.
Instead, this commit updates the heuristic to be more accurate in
determining whether the input is a label value without a label name
and operator or if it is a complete matcher that should be parsed
from start to end.
Signed-off-by: George Robinson <george.robinson@grafana.com>
9e40db8 to
6c36478
Compare
Collaborator
Author
|
Here is an example of what is fixed:
🔁 means No change |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit fixes some of the unexpected behavior when interpreting matchers in amtool.
Before this commit,
<matcher-groups>that looked like a valid matcher such as{foo=bar}would have"alertname"prefixed as amtool considered it to be a label value. However, this would create a silence foralertname="{foo=bar}"which is almost never want the user intended.Instead, this commit updates the heuristic to be more accurate in determining whether the input is a label value without a label name and operator or if it is a complete matcher that should be parsed from start to end.
Fixes #3385