* Make filter labels consistent with Prometheus
Filtering the alert out when the label is missing precludes a
possible match for an empty value. This change allows the
match to be evaluated.
Closes#2342
Signed-off-by: Victor Araujo <vear91@gmail.com>
* Add tests for matchFilterLabels in v2 api
Signed-off-by: Victor Araujo <vear91@gmail.com>
* prometheus/alertmanager#2372 Move config reload metrics to Coordinator.Reload()
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* #2372 Minor refactoring.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
PagerDuty Event API v2 [1] requires images to have an `src` property, and links
to have an `href` property.
This commit filters out images and links that don't satisfy those conditions,
to avoid getting an HTTP 400 error in response.
This also adds flexibilty when using templates to configure images and links,
as it's now possible to omit images or links by letting the template return an
empty string for the `src` or `href` property, respectively.
[1]: https://developer.pagerduty.com/docs/events-api-v2/trigger-events/#context-properties
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
The "empty" boolean is the false value. This means that values of false will not
be present in the YAML output. As such they won't be displayed in the config
section on the Status overview page (/#/status), which can be especially
confusing for the SMTPRequireTLS (smtp_require_tls) field of the configuration
as this one will default to true.
Signed-off-by: Tim Reddehase <tim.reddehase@new-work.se>
* notify: add markdown support for wechat
Signed-off-by: Jason Cooper <master@deamwork.com>
* docs: update WeChat receiver configuration document
Signed-off-by: Jason Cooper <master@deamwork.com>
* fix: check WeChat msgType, apply default if not present
Signed-off-by: Jason Cooper <master@deamwork.com>
* chore: remove unnecessary comment
Signed-off-by: Jason Cooper <master@deamwork.com>
* fix: simplify msgType process
Signed-off-by: Jason Cooper <master@deamwork.com>
* docs: wechat configs document update
Signed-off-by: Jason Cooper <master@deamwork.com>
* fix: apply error message suggestions
Signed-off-by: Jason Cooper <master@deamwork.com>
* test: add test for regex
Signed-off-by: Jason Cooper <master@deamwork.com>
* fix: wechat message safe param
Signed-off-by: Jason Cooper <master@deamwork.com>
Relative links are rendered relatively to the source repository, so this
link points to GitHub at the moment.
This commit changes the link to an absolute URL, bringing readers to the
Routing tree editor.
Signed-off-by: Manuel Hutter <manuel@hutter.io>
Co-authored-by: Manuel Hutter <mhutter@users.noreply.github.com>
Relative links are rendered relatively to the source repository, so this
link points to GitHub at the moment.
This commit changes the link to an absolute URL, bringing readers to the
Routing tree editor.
Signed-off-by: Manuel Hutter <manuel@hutter.io>
By default the library implementing the back-off timer stops the timer
after 15 minutes. Since the code never checked the value returned by the
ticker, notification retries were executed without delay after the 15
minutes had elapsed (e.g. for `group_interval` greater than 15m).
This change ensures that the back-off timer never expires.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
As 0.21.0 will update clusters, we want to know of people have all their
AM at the same release when they open a clustering issue.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* notify: improve logs on notification errors
Alertmanager can experience occasional failures when sending
notifications to an external service. If the operation succeeds after
some retry, the 'alertmanager_notifications_failed_total' metric
increases but nothing is logged (unless running with log.level=debug).
Hence an operator might receive an alert about notification failures but
wouldn't know which integration was failing.
With this change, notification failures are logged at the warning level.
To avoid log flooding, similar failures on retries aren't logged.
Additional information on the failing integration has also been added.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Log notify success at info level if it's a retry
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Allow limiting maximum number of alerts in webhook
The webhook notifier is the only notifier that does not allow templating
on the Alertmanager side. Users who encounter occasional alert storms
(10ks of alerts going off at once for the same group) have reported
webhook receiver systems not being able to cope with the load caused by
the resulting large webhook notifier messages (the alerting rules also
contained large annotations that can't be stripped away due to lack of
templating). Reducing group size also wasn't an option, but this change
proposes to allow truncating the list of alerts sent in the webhook body
to a provided maximum length. This assumes that e.g. if a group receives
20k alerts, you really are fine only receiving 10k because you wouldn't
be able to check them all anyway.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Change max_alerts to uint32
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Add truncatedAlerts field to webhook message
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Fix JSON struct tag
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* .circleci/config.yml: collect test metadata
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Store frontend test results too
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* 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>