This adds support for retrieving the states from the cluster Peer.
This is useful for moving around the states from replica to replica when deem neccesary - while not stricily useful for the Alertmanager itself at the moment, we have a need to support migrations between different types of Alertmanager and this helps the cause.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
There's no change to the logic here - it just stroke me as odd that we were reusing the response from alerting groups in the silences call when it's pretty simple to add a new one in the API description.
This is more accurate as well, as this will be used to power the documentation.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
* Rename feature flags and make package public
This commit renames the feature flags "classic-matchers-parsing"
and "utf8-matchers-parsing" to "classic-matchers" and "utf8-matchers".
This better represents their use, for example, when validating
both alerts and silences created via the API.
It also makes the feature flags package public for two reasons:
1. AllowedFlags is a public variable
2. We would rather use these consts in Mimir then have to hardcode
the strings ourselves, and be subject to breaking changes in future
Signed-off-by: George Robinson <george.robinson@grafana.com>
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Reflect Discord's max length message limits
Signed-off-by: Tomas Kozak <kozak@talko.cz>
* Fix log key name
Signed-off-by: Tomas Kozak <kozak@talko.cz>
---------
Signed-off-by: Tomas Kozak <kozak@talko.cz>
* Update Stringer for non-Prometheus compliant label names
This commit updates the String method to print non-Prometheus
compliant label names in a format that can be parsed in the
UTF-8 parser. Such inputs are never valid in the classic parser.
If the label name is Prometheus compliant, it is still printed
unquoted.
Signed-off-by: George Robinson <george.robinson@grafana.co
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
Quoted tokens can contain both UTF-8 byte and code point literals
that should be interpreted when quoted. However, we need to check
that the interpreted literals are valid UTF-8 code points or not.
This now happens in unquote.
Signed-off-by: George Robinson <george.robinson@grafana.com>
This commit removes the open and close braces from the suggestion
as braces do not make sense in the configuration file. This does
not change the behavior of the suggestion whatsoever as these
are optional.
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Do not allow unquoted escape sequences
This commit updates the matchers parser to reject unquoted
openmetrics escape sequences. As an example, foo=bar\n
will no longer parse, and must instead be written as
foo="bar\n". This avoids an issue where the input is valid
in both the matchers and classic parsers, but results
in two different parsings.
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Update compliance tests
This commit updates compliance tests to include openmetrics
escape sequences that are not valid in the UTF-8 matchers parser.
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Add tests for openmetrics escape sequences
Signed-off-by: George Robinson <george.robinson@grafana.com>
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
This commit adds debug logs to MuteStage that logs when an alert
is muted. This can help operators root cause missing notifications
when alerts are silenced by mistake or purpose but then forgotten
about.
Signed-off-by: George Robinson <george.robinson@grafana.com>
Bumps the API spec/client generation util of `go-swagger` from 0.30.2 to 0.30.5 which is the latest stable.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
* Add adapter package for parser feature flag
This commit adds the compat package allowing users to switch
between the new matchers/parse parser and the old pkg/labels parser.
The new matchers/parse parser uses a fallback mechanism where if
the input cannot be parsed in the new parser it then attempts to
use the old parser. If an input is parsed in the old parser but
not the new parser, then a warning log is emitted.
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Move and export BuildReceiverIntegrations
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
---------
Signed-off-by: Alex Weaver <weaver.alex.d@gmail.com>
This commit updates Alertmanager to add a duration to the notify
success message. It complements the existing histogram to offer
fine-grained information about notification attempts. This can be
useful when debuggin duplicate notifications, for example, when
the duration exceeds peer_timeout.
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Refactor: Move `inTimeIntervals` from `notify` to `timeinterval`
There's absolutely no change of functionality here and I've expanded coverage for similar logic in both places.
---------
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Although it is true that Repeat interval should be greater than or
equal to the Group interval, it should also be a multiple of it too.
If the Repeat interval is not a multiple, then because of how aggregation
groups are flushed, it will be made into one implicitly. This commit
documents this behavior.
Signed-off-by: George Robinson <george.robinson@grafana.com>
* actions: cross build in ci and fix publish
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
* actions: build before release publishing
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
---------
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
* Move CI to github actions
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
* Skip email test in github action
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
* build before lint
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
---------
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
* Add tests for PromQL braces when using amtool alert
Signed-off-by: George Robinson <george.robinson@grafana.com>
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Add test for PromQL braces when parsing lists of matchers
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Use acceptance tests
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Add test creating silence with braces
Signed-off-by: George Robinson <george.robinson@grafana.com>
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Add receiver name as a label to notify metrics
This commit adds in a second label to the notify family of metrics
(e.g. numTotalFailedNotifications) - the receiver name. This allows
disambiguating which receiver is failing when one has many receivers
with the same integration type
Signed-off-by: sinkingpoint <colin@quirl.co.nz>
* Gate receiver names behind a feature flag
Signed-off-by: sinkingpoint <colin@quirl.co.nz>
---------
Signed-off-by: sinkingpoint <colin@quirl.co.nz>
Signed-off-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>