1
0
mirror of https://github.com/prometheus/alertmanager.git synced 2026-02-05 15:45:34 +01:00

25 Commits

Author SHA1 Message Date
Cody Kaczynski
05d4f1879a fix(bug): memory leak in tracing client (#4828)
* fix(bug): memory leak in tracing client

Signed-off-by: Cody Kaczynski <ckaczyns@akamai.com>

* fix: add tracing wrapper

Signed-off-by: Cody Kaczynski <ckaczyns@akamai.com>

---------

Signed-off-by: Cody Kaczynski <ckaczyns@akamai.com>
2026-01-09 16:10:10 +01:00
Walther Lee
740b62ba2b Support templating in webhook url fields (#4798)
* support templating in webhook url fields

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

* add validations and tests for webhookconfig templated url

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

* make lint

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

* create SecretTemplURL

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

* rm old comment

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

* rename to SecretTemplateURL

Signed-off-by: Walther Lee <walthere.lee@gmail.com>

---------

Signed-off-by: Walther Lee <walthere.lee@gmail.com>
2026-01-05 18:09:28 +01:00
TJ Hoplock
1e01172857 Logging improvements (#4113)
* ref(webhook): return error if unable to parse group key

Addresses feedback from another PR
https://github.com/prometheus/alertmanager/pull/4089#discussion_r1824480384

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* fix(silence): log errors at ERROR level instead of INFO

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* chore(notify): make logging more consistent, converge on `group_key`

This changes the majority of our `Notify()` implementations to set up a
new logger with the group key attached under the key name `group_key`,
and then to use that logger in all subsequent calls to the logger,
including passing it through to further functions that accept loggers
via params.

A few of the notify implementations are more complicated; they either
extract the key later in their `Notify()` implementation or within sub
methods, or even conditionally like with sns. I left those mostly as is
for now, as they seem to be more snow-flake-y.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

---------

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2025-11-14 07:52:11 +01:00
Guido Trotter
e3d4214584 tests: Use t.TempDir() (#4730)
A lot of tests create temporary files. Only one cleans up.
Use t.TempDir() in the CreateTemp calls, to get automatic cleanup.

Signed-off-by: Guido Trotter <guido@hudson-trading.com>
Co-authored-by: Guido Trotter <guido@hudson-trading.com>
2025-11-13 15:34:27 +01:00
Cameron Hall
80d0265e16 chore: improves logging around webhook dispatch failure (#4511)
Signed-off-by: CameronHall <cameron.hall@target.com>
Co-authored-by: CameronHall <cameron.hall@target.com>
2025-11-05 22:04:52 +01:00
SuperQ
e3725c1290 Update Go
* Update Go build to 1.24.
* Update minimum Go version to 1.23.
* Fixup various testifylint issues.

Signed-off-by: SuperQ <superq@gmail.com>
2025-03-27 09:56:40 +01:00
Steve Simpson
0f65e8fa5f Add timeout option for webhook notifier. (#4137)
* Add timeout option for webhook notifier.

Signed-off-by: Steve Simpson <steve@grafana.com>

* Tweak error handling and de-pointer timeout field.

Signed-off-by: Steve Simpson <steve@grafana.com>

---------

Signed-off-by: Steve Simpson <steve@grafana.com>
2024-12-02 14:53:51 +00:00
TJ Hoplock
f6b942cf9b chore!: adopt log/slog, drop go-kit/log (#4089)
* chore!: adopt log/slog, drop go-kit/log

The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

This commit includes several changes:
- bump exporter-tookit to v0.13.1 for log/slog support
- updates golangci-lint deprecated configs
- enables sloglint linter
- removes old go-kit/log linter configs
- introduce some `if logger == nil { $newLogger }` additions to prevent
  nil references
- converts cluster membership config to use a stdlib compatible slog
  adapter, rather than creating a custom io.Writer for use as the
membership `logOutput` config

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* chore: address PR feedback

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

---------

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-11-06 09:09:57 +00:00
Holger Freyther
cb9724db47 notify/webhook: Fix crash on errors when url_file is used (#3798) (#3800) 2024-04-12 11:28:59 +02:00
Matthieu MOREL
b9e347b9d1 golangci-lint: enable testifylint linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-10 08:50:03 +00:00
Davide Bizzarri
140c3d683f notify/webhook: trim space from url_file content
Signed-off-by: Davide Bizzarri <davide.bizzarri@neoom.com>
2023-05-16 13:30:06 +02:00
Yijie Qin
9a8d1f976e add reason code to notifiers (#3307)
* add reason code to notifiers

Signed-off-by: Yijie Qin <qinyijie@amazon.com>
2023-04-07 17:05:17 +02:00
Simon Rozet
41eb1213bb support loading webhook URL from a file (#3223)
* support loading webhook URL from a file

/cc #2498

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/webhook: add test for reading url from file

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/pushover: add tests for reading secrets from files

Signed-off-by: Simon Rozet <me@simonrozet.com>

---------

Signed-off-by: Simon Rozet <me@simonrozet.com>
2023-03-03 15:31:14 +01:00
Simon Rozet
8f559aad34 mark webhook URL as a secret (#3228)
Signed-off-by: Simon Rozet <me@simonrozet.com>
2023-02-02 16:23:51 +00:00
Oktarian T-B
d4d36e400a Log Response Details for Notifier errors for Webhooks, Pushover and VictorOps (#3103)
* Pass in response body to Retrier Check
* Custom error details for webhook notifier

Signed-off-by: Oktarian Tilney-Bassett <oktariantilneybassett@improbable.io>
2022-10-19 15:07:38 +02:00
Julien Pivotto
d59548fbab Enable HTTP 2 again (#2720)
We are re-enabling HTTP 2 again. There has been a few bugfixes upstream
in go, and we have also enabled ReadIdleTimeout.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-11-10 17:28:47 +01:00
István Gazsi
78fdd6f56b Generalize User-Agent header in receiver requests (#2722) (#2730)
Signed-off-by: István Gazsi <istvan.gazsi@theag3nt.com>
2021-10-18 14:34:22 +02:00
Julien Pivotto
b2a4cacb95 Update go dependencies & switch to go-kit/log
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-08-02 12:43:23 +02:00
Marco Pracucci
04d683e880 Upgrade prometheus/common
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2021-04-21 12:01:34 +02:00
Marco Pracucci
37f4742922 Add HTTP client options to receiver integrations
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2021-04-21 11:56:20 +02:00
Julien Pivotto
470634d49f Update common (#2353)
- Disable HTTP2: https://github.com/prometheus/common/pull/249
- Composite duration: https://github.com/prometheus/common/pull/246

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-08-25 15:48:59 +02:00
Julius Volz
70b5e00ffc Allow limiting maximum number of alerts in webhook (#2274)
* 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>
2020-06-04 10:07:33 +02:00
Simon Pasquier
94d875f122 Bump prometheus/client_golang to v1.1.0 (#1989)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-08 14:36:10 +02:00
Simon Pasquier
655947d7e0 notify: refactor code to retry requests (#1974)
* notify: refactor code to retry requests

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

* s/Process/Check/

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-02 16:17:40 +02:00
Simon Pasquier
0c3120efac *: split notify package
Instead of keeping all notifiers in the notify package, it splits them
into individual sub-packages. This improves readability and
maintainability of the code.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-06-18 15:36:19 +02:00