Commit Graph

9 Commits

Author SHA1 Message Date
gotjosh bd89550ce2
Take another approach
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-09-30 12:36:32 +01:00
gotjosh 05f073f42f
Ensure matcher values are present when parsing matchers from strings
Fixes #2936

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2022-09-30 12:36:32 +01:00
Bartlomiej Plotka 02346e4e49
matchers: Parse Matcher now expects consistent enclosing with quotes. (#2632)
Fixes https://github.com/prometheus/alertmanager/issues/2630

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2021-06-23 10:05:49 +01:00
beorn7 99e4a4fbae Address code review comments
Signed-off-by: beorn7 <beorn@grafana.com>
2021-01-13 18:49:06 +01:00
beorn7 3ce1d888d7 labels.ParseMatchers: Allow escaped quotes
Previously, escaped double quotes would still be seen as ending the
quoting, potentially leading to wronk tokenization.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-23 22:37:12 +01:00
beorn7 9bb7ab43cd labels.Matcher: Improve regexp and allow escaping
This addresses a number of issues:

- It was impossible to include a literal '"' or a line break in the value.
- It was impossible to include '=', '~', or '!' in the value.
- It was not validated if the label name is valid.
- It was not validated if the value is valid UTF-8.
- No whitespace was allowed around the operator.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-23 21:55:30 +01:00
beorn7 e87985a9a8 Add doc comments to labels.ParseMatcher and labels.ParseMatchers
The doc comments do not describe the current (arguably buggy) state,
but the desired state, as it will be implemented in future commits.

Signed-off-by: beorn7 <beorn@grafana.com>
2020-12-23 20:47:35 +01:00
Simon Pasquier e0cc523893
api/v2: add path and method to API v2 logs (#2261)
* api/v2: add path and method to API v2 logs

When an API v2 handler logged a message, the log wouldn't include the
path and method. Since different handlers perform the same validations
(e.g. matchers for alerts and silences), it isn't easy to know which
handler was invoked (though the logged filename
+ line number provides a hint).

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Capitalize messages + improve logs

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-06-02 16:13:31 +02:00
Simon Pasquier e4437ab54f
*: remove dependency on github.com/prometheus/prometheus (#2009)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-16 10:56:29 +02:00