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

504 Commits

Author SHA1 Message Date
Holger Waschke
f7a37c88e7 Jira Integration: fix for handling jira api v3 with ADF (#4756)
Signed-off-by: Holger Waschke <waschkester@gmail.com>
2026-01-30 18:06:54 +01:00
mihir-dixit2k27
1946357aa3 feat(slack): add support for top-level text field in Slack notificati… (#4867)
* feat(slack): add support for top-level text field in Slack notifications (#3071)
---------

Signed-off-by: mihir-dixit2k27 <mihidixi@gmail.com>
Signed-off-by: Mihir Dixit <dixitmihir1@gmail.com>
Signed-off-by: mihir-dixit2k27 <143348248+mihir-dixit2k27@users.noreply.github.com>
2026-01-30 11:07:49 +01:00
Gintoms
bc26ebb5e4 smtp: Customize the SSL/TLS port support (#4757) (#4818)
Signed-off-by: gintom <17498860+Gintoms@users.noreply.github.com>
2026-01-30 11:06:57 +01:00
Ethan Hunter
b5df726c8f Add arbitrary key/value data store to the nflog (#4899)
* add arbitrary nflog data storage

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>

* improve isFirstNotification logic

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>

* add docstring and ensure input map not modified

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>

* appease linter

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>

---------

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
2026-01-28 21:18:56 +01:00
Alex
ec88c5b5b7 fix(jira): prevent hostname corruption in Cloud API URL replacement (#4892)
The previous implementation used strings.Replace to change '/2' to '/3'
in the API URL path, but this incorrectly matched and replaced the '2'
in hostnames containing that character (e.g., 'example2.atlassian.net'),
resulting in malformed URLs like 'https://example3.atlassian.net/...'.

This fix makes the replacement more specific by targeting the full
'/rest/api/2/' path instead of just '/2', ensuring only the API version
in the path is modified, not characters in the hostname.

Signed-off-by: alex-deploys <alex-deploys@users.noreply.github.com>
Co-authored-by: alex-deploys <alex-deploys@users.noreply.github.com>
2026-01-28 21:02:25 +01:00
Gulshan
e9b9ecdc0c Add chat_id_file configuration parameter for Telegram (#4909)
Signed-off-by: gulshank0 <gulshanbahadur002@gmail.com>
2026-01-28 18:51:28 +01:00
Rudo Thomas
f47f8d1b95 chore(notify.go): Clean up duplicate code in RetryStage.exec (#4893)
The code in the two selects in case ctx is done is exactly the same.
Remove the second copy, the first one will be reached via the for loop.

Signed-off-by: Rudolf Thomas <rudolf.thomas@firma.seznam.cz>
2026-01-28 18:32:59 +01:00
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
Martin Schimandl
9b4c6ddc4d Add support for AuthSecret from file (#3087)
* Add support for AuthSecret from file

Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>

* Make the linter happy

Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>

---------

Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>
2026-01-08 11:53:50 +01:00
Christoph Maser
cae1590129 feat: add config directive to pass wechat api secret via file (#4734)
Ref: #2498

Signed-off-by: Christoph Maser <christoph.maser+github@gmail.com>
2026-01-05 18:13:23 +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
Siavash Safi
18939cee8f feat: add distributed tracing support (#4745)
Add tracing support using otel to the the following components:
- api: extract trace and span IDs from request context
- provider: mem put
- dispatch: split logic and use better naming
- inhibit: source and target traces, mutes, etc. drop metrics
- silence: query, expire, mutes
- notify: add distributed tracing support to stages and all http requests

Note: inhibitor metrics are dropped since we have tracing now and they
are not needed. We have not released any version with these metrics so
we can drop them safely, this is not a breaking change.

This change borrows part of the implementation from #3673
Fixes #3670

Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Co-authored-by: Dave Henderson <dhenderson@gmail.com>
2025-12-05 22:58:44 +01:00
Solomon Jacobs
dbf48e27bb chore: remove trivago (#4763)
* jira: add additional test case for Fields

This ensures we don't have a regression in this area.

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>

* chore: remove trivago

This dependency is unmaintained and has recently been archived. The
function we used is equivalent to:

```go
import "reflect"

func TryConvertToMarshalMap(value any) any {
	valueMeta := reflect.ValueOf(value)
	switch valueMeta.Kind() {
	case reflect.Array, reflect.Slice:
		arrayLen := valueMeta.Len()
		converted := make([]any, arrayLen)
		for i := range arrayLen {
			converted[i] = TryConvertToMarshalMap(valueMeta.Index(i).Interface())
		}
		return converted

	case reflect.Map:
		converted := make(map[string]any)
		keys := valueMeta.MapKeys()

		for _, keyMeta := range keys {
			strKey, isString := keyMeta.Interface().(string)
			if !isString {
				continue
			}
			val := valueMeta.MapIndex(keyMeta).Interface()
			converted[strKey] = TryConvertToMarshalMap(val)
		}
		return converted

	default:
		return value

	}
}
```

So, all it does is replace `map` types with `map[string]any` and skip
keys, which are not of type string. However, `DeepCopyWithTemplate`
already does this with the only difference being that it passes
`len(keys)` as a capacity.

Moreover, `ConvertToMarshalMap` does not return an error, if one passes
an object of type `map`. So, the extra error check was redundant as
well.

In other words, omitting this function call does not affect behaviour.

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>

---------

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
2025-12-05 16:15:41 +01:00
Siavash Safi
e3c74f565b feat: allow nested details fields in pagerduty (#3944)
This change allows nested key/value pair in pageduty configuration.
Events API V1 supports an object in `details` field:
https://developer.pagerduty.com/docs/send-v1-event#parameters

Events API V2 supports an object in `payload.custom_details` field:
https://developer.pagerduty.com/docs/send-alert-event#parameters

The configuration and message/payload types where changed from
`map[string]string` to `map[string]any`.

The default template is updated to use the new `toJson` function.

Fixes #2477
Fixes #3218

Signed-off-by: Siavash Safi <siavash@cloudflare.com>
2025-12-05 16:12:25 +01:00
Michael Stapelberg
4e54940287 feat: implement threading to group email alert groups into threads (#4623)
Some email clients such as Gmail apparently use their own heuristics
for threading and already implement this behavior based on the subject.

But for users of other email clients that only implement threading
based on the relevant headers (e.g. notmuch), those users currently
get one email thread for each newly firing alert.

With threading enabled, all alert emails (of the same alert)
on the same day are grouped into the same thread. Much nicer :)

Signed-off-by: Michael Stapelberg <stapelberg@google.com>
2025-12-02 16:28:59 +01:00
Solomon Jacobs
b91e9934d1 chore: interface{} -> any in comments (#4751)
Tiny left over from
https://github.com/prometheus/alertmanager/pull/4750

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
2025-11-21 15:07:46 +01:00
Holger Waschke
a90da796bd Jira Integration: Allow configuring issue update via parameter (#4621)
* Jira Integration: Allow configuring issue update via parameter

---------

Signed-off-by: Holger Waschke <waschkester@gmail.com>
2025-11-18 18:12:39 +01:00
Ben Kochie
f656273159 Enable modernize linter (#4750)
Enable the golangci-lint modernize linter.
* Add exception for the omitempty struct issue.
* Apply modernize fixes.

Signed-off-by: SuperQ <superq@gmail.com>
2025-11-18 11:46:15 +01:00
Solomon Jacobs
023885c52c chore: modernize with range over int (#4746)
A purely mechanical change with no effect on behaviour. Stops `gopls`
from complaining.

Corresponding spec, see here:
https://github.com/golang/go/issues/61405

Introduced in `Go 1.22`, see here:
https://go.dev/ref/spec#For_range

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
2025-11-18 09:43:43 +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
Ben Kochie
92ecf8b93b chore: Migrate more metrics to promauto (#4700)
Migrate a few more metrics to the `promauto` package.

Signed-off-by: SuperQ <superq@gmail.com>
2025-11-06 09:27:05 +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
promalert
7d6cebe45a refactor: use b.Loop() to simplify the code and improve performance (#4642)
Signed-off-by: promalert <promalert@outlook.com>
2025-11-03 21:47:20 +01:00
Holger Waschke
c94cdfdf3e add deepcopywithtemplate function to be able to use templated custom fields (#4029)
Signed-off-by: Holger Waschke <holger.waschke@dvag.com>
2025-11-03 21:09:45 +01:00
nick
3b515b7dc0 add Mattermost integration (#4090)
* add mattermost integration

---------

Signed-off-by: UndeadDemidov <45305584+UndeadDemidov@users.noreply.github.com>
Signed-off-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Siavash Safi <git@hosted.run>
2025-11-03 21:08:49 +01:00
Ben Kochie
81eff8c016 Refactor metric registration (#4639)
Migrate metrics to use promauto to avoid forgotten metric
registration.

Signed-off-by: SuperQ <superq@gmail.com>
2025-10-29 16:03:55 +01:00
Solomon Jacobs
5a36856f11 tiny refactor: use slices.Contains (#4631)
No change in behaviour.

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
2025-10-27 21:24:36 -04:00
Joe Adams
0ba3c088f9 CI: add maildev tests back to GA (#4477)
* Update CI test to include maildev tests

Signed-off-by: Joe Adams <github@joeadams.io>

* Update test comments about maildev

Signed-off-by: Joe Adams <github@joeadams.io>

* Disable CircleCI workflows

Signed-off-by: Joe Adams <github@joeadams.io>

* Fix Circle config

Signed-off-by: Joe Adams <github@joeadams.io>

---------

Signed-off-by: Joe Adams <github@joeadams.io>
2025-10-21 21:41:09 -04:00
Holger Waschke
f5b5fd2119 fix(jira_test.go): issueSearchResult struct doesnt contain total anymore adapt unit test accordingly
Signed-off-by: Holger Waschke <holger.waschke@dvag.com>
2025-10-21 09:50:42 +02:00
Holger Waschke
474810adc5 fix a bug how to count for existing jira issues
Signed-off-by: Holger Waschke <holger.waschke@dvag.com>
2025-10-21 09:50:42 +02:00
SuperQ
fb78d1fe6b Fixup linting issue
Fix formatting issue.

Signed-off-by: SuperQ <superq@gmail.com>
2025-10-19 09:15:55 +02:00
Ben Kochie
ca9ed08940 Merge pull request #4354 from eyazici90/local/timeoutt
feat: add timeout option for pagerduty notifier
2025-10-19 08:06:43 +01:00
Ben Kochie
9ec88ae6ff Merge pull request #4355 from eyazici90/local/slack-timeout
feat: add timeout option for slack notifier
2025-10-19 08:05:52 +01:00
Ben Kochie
a70711aad0 Update Go (#4589)
* Update Go to 1.25.
* Update minimum Go version to 1.24.0.
* Group github.com/go-openapi dependencies.
* Enable dependabot for github actions.

Signed-off-by: SuperQ <superq@gmail.com>
2025-10-08 07:04:21 -04:00
gotjosh
803d9e2c7c Change maxPayloadSize comment to MaxPayloadSize
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2025-09-22 17:04:33 +01:00
Isaac Seymour
c22bd504ce Apply comments from @gotjosh
Signed-off-by: Isaac Seymour <i.seymour@oxon.org>
2025-09-22 16:27:00 +01:00
gotjosh
63bc1ef12a Merge branch 'main' into rorymalcolm/incidentio-notifier 2025-09-22 15:30:46 +01:00
Chris Jedro
cfd70e5047 Add new Jira search endpoint with new api_type option and auto detect (#4542)
* Add new Jira search endpoint with new api_type option and auto detect

Signed-off-by: christianjedro <cj@cloudeteer.de>

* adding recommendations, update doku, add comments

Signed-off-by: christianjedro <cj@cloudeteer.de>

* remove global api type (recommended by @jkroepke), add default value and remove test + implementation for empty string

Signed-off-by: christianjedro <cj@cloudeteer.de>

* dco

Signed-off-by: christianjedro <cj@cloudeteer.de>

* add better explanation

Signed-off-by: christianjedro <cj@cloudeteer.de>

---------

Signed-off-by: christianjedro <cj@cloudeteer.de>
2025-09-16 20:32:47 -04:00
rory malcolm
edb9a4d936 Merge branch 'main' into rorymalcolm/incidentio-notifier 2025-09-04 11:40:44 +01:00
Hélia Barroso
e75b0814e9 feat: replace interface with any
Signed-off-by: Hélia Barroso <helia_barroso@hotmail.com>
2025-08-28 11:29:43 +01:00
Joe Adams
26ae038b2d Merge pull request #4368 from mmorel-35/golangci-lint@v2
chore: bump golangci-lint to v2.3.0
2025-08-10 21:31:01 -04:00
Isaac Seymour
0d86b5ba09 Simplify truncation strategy
Rather than carefully trying to shrink the size of the payload to fit
the 512kB limit, just try two encodings:
1. The full original message; and
2. Remove all but the first alert in the group and send that

For most configurations, each message creates a single alert in
incident.io, with the details of the alerts which made up that group
contained within being useful but not essential.

This means the code is a lot simpler, and does at-most 2 JSON encodings
for each message (although in general it should be pretty rare to need
to do more than 1!)

Signed-off-by: Isaac Seymour <i.seymour@oxon.org>
2025-08-07 09:20:34 +01:00
Rory Malcolm
b8fc677c29 feat: incident.io Notifier
- Adds the technical implementation, and tests, for the incident.io notifier

- Configured through the following config:

```yaml
receivers:
  - name: 'incidentio-notifications'
    incidentio_configs:
      - url: '$alert_source_url'
        alert_source_token: '$alert_source_token'
```

- Add documentation for the incidentio_config

Signed-off-by: Isaac Seymour <i.seymour@oxon.org>
2025-08-06 17:47:30 +01:00
pehlicd
83b894691f chore(deps): Upgrade AWS SDK to v2
Signed-off-by: pehlicd <furkanpehlivan34@gmail.com>
2025-08-05 19:47:33 +02:00
Matthieu MOREL
31b64f6a00 chore: bump golangci-lint to v2.3.0
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-01 23:40:52 +02:00
pehlicd
732172c265 fix jira notifier reopen logic
Signed-off-by: pehlicd <furkanpehlivan34@gmail.com>
2025-07-15 16:38:50 +02:00
Markus Cisler
d1adca618c pushover: Add monospace message formatting option
Signed-off-by: Markus Cisler <hello@markuscisler.com>
2025-05-04 21:14:17 +02:00
Emre Yazici
8da7f29a23 test: lean towards table driven testing
To improve readability of the test.

Signed-off-by: emreya <e.yazici1990@gmail.com>
2025-04-18 14:53:26 +02:00
Emre Yazici
9e319fe837 test: add a test for slack timeout option
To see if timeout option is obeyed.

Signed-off-by: emreya <e.yazici1990@gmail.com>
2025-04-18 14:44:45 +02:00