Skip to content

add silence annotations#4965

Merged
Spaceman1701 merged 2 commits intoprometheus:mainfrom
Spaceman1701:add-silence-annotations
Feb 17, 2026
Merged

add silence annotations#4965
Spaceman1701 merged 2 commits intoprometheus:mainfrom
Spaceman1701:add-silence-annotations

Conversation

@Spaceman1701
Copy link
Copy Markdown
Contributor

Silence annotations are... annotations... for silences!

Just like alert annotations, silence annotations are an optional LabelSet which provides structured key->value data on silences. Annotations are added to the underlying cluster model for silences so they're synced properly between nodes in HA mode.

This is a simple change that adds a lot of value: with structured fields, it's possible to add both machine and human readble metadata for silences. In HRT, we use annotations to indicate the purpose of silences, associate them with machine processes, and encode conventions. The format is flexible so it's possible to encode any number of things.

Copy link
Copy Markdown
Contributor

@SoloJacobs SoloJacobs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a bit more test coverage would go here, most importantly a round trip test:
post silence (using amtool) -> get silence -> compare annotations.

cli/silence_add.go and api/v2/compat.go could also be tested.

I also assume that we expect amtool to not have an error, if you post to an older alertmanager version?

@Spaceman1701 Spaceman1701 requested a review from TheMeier February 9, 2026 15:13
@Spaceman1701
Copy link
Copy Markdown
Contributor Author

I think a bit more test coverage would go here, most importantly a round trip test: post silence (using amtool) -> get silence -> compare annotations.

cli/silence_add.go and api/v2/compat.go could also be tested.

Sure, I'll add a test case for the round trip, that's a good idea.

I also assume that we expect amtool to not have an error, if you post to an older alertmanager version?

Ah yeah, let me also make sure that works - I think if you set annotations and try to post to an old alertmanager it should be expected to break. If you don't, I think it's reasonable to make it work.

We don't really have a version skew policy, but I guess at some point we'll need to think about guidelines for which versions of amtool ought to be compatible with which versions of alertmanager...

@Spaceman1701 Spaceman1701 force-pushed the add-silence-annotations branch 2 times, most recently from ea7f90e to ce8d6c3 Compare February 10, 2026 17:23
@TheMeier
Copy link
Copy Markdown
Contributor

amtool already checks if the versions differ

For a users perspective the optimal behaviour would be amtool printing a warning if annotations are passed but the server version does not handle them but work otherwise.

@Spaceman1701
Copy link
Copy Markdown
Contributor Author

amtool already checks if the versions differ

For a users perspective the optimal behaviour would be amtool printing a warning if annotations are passed but the server version does not handle them but work otherwise.

Agreed this would be the nicest behavior. However, it's a bit of work to implement because I don't know what semantic version of alertmanager will start supporting silence annotations...

I could think of something to make this work, but given that this is a bit of a corner case (the user is using a new version of amtool on an old version of alertmanager and is trying to set annotations), I don't think we should worry too much.

Copy link
Copy Markdown
Contributor

@siavashs siavashs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread cli/silence_add.go
@SoloJacobs
Copy link
Copy Markdown
Contributor

I quite like the new test! Thanks for adding it. Regarding the amtool - alertmanager compatibility: Well at least there is a warning. So, LGTM 👍

@TheMeier TheMeier removed their request for review February 12, 2026 19:44
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
@Spaceman1701 Spaceman1701 force-pushed the add-silence-annotations branch from cb3fed3 to 3471e46 Compare February 17, 2026 18:28
@Spaceman1701 Spaceman1701 merged commit bb094da into prometheus:main Feb 17, 2026
8 checks passed
coatico pushed a commit to coatico/alertmanager that referenced this pull request Mar 10, 2026
Adds optional key/value pair annotations to silences. This is useful for storing structured data about the silence. Right now, clients have to process annotations themselves.

---------

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
coatico pushed a commit to coatico/alertmanager that referenced this pull request Mar 10, 2026
Adds optional key/value pair annotations to silences. This is useful for storing structured data about the silence. Right now, clients have to process annotations themselves.

---------

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
Signed-off-by: VAN LINT <marnix.vanlint@worldline.com>
SoloJacobs pushed a commit to SoloJacobs/alertmanager that referenced this pull request Mar 15, 2026
Adds optional key/value pair annotations to silences. This is useful for storing structured data about the silence. Right now, clients have to process annotations themselves. 

---------

Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
SoloJacobs added a commit to SoloJacobs/alertmanager that referenced this pull request Apr 6, 2026
* [CHANGE] `go get github.com/prometheus/alertmanager/ui` will now fail as compiled UI assets are no longer checked into the repository. Downstream builds that rely on these assets being present in the source tree must now build the UI from source. prometheus#5113
* [CHANGE] The '--enable-feature=auto-gomaxprocs' option is deprecated and will be removed in v0.33. This flag currently has no effect and can be safely removed from any startup scripts. prometheus#5090
* [CHANGE] Update internal function signatures across multiple packages. This affects any project that integrates `Alertmanager` code.
* [ENHANCEMENT] Add static asset caching. prometheus#5113
* [ENHANCEMENT] Reduce memory allocations through pre-sizing collections and batch allocation. prometheus#5020
* [ENHANCEMENT] Replace help with documentation in navigation bar. prometheus#4943
* [ENHANCEMENT] docs(ha): Update high availability documentation. prometheus#5136
* [ENHANCEMENT] docs: Add `auth_secret_file` for smtp in document. prometheus#5036
* [ENHANCEMENT] docs: Add description for global `telegram_bot_token`. prometheus#5114
* [ENHANCEMENT] docs: Add note about notifier timeouts. prometheus#5077
* [ENHANCEMENT] docs: Fix `force_implicit_tls` config field name. prometheus#5030
* [ENHANCEMENT] docs: Link community supported integrations. prometheus#4978
* [ENHANCEMENT] docs: Remove duplicate header. prometheus#5034
* [ENHANCEMENT] docs: Update mutual tls reference in high availability documentation. prometheus#5120
* [ENHANCEMENT] tracing: Use noop spans when tracing disabled. prometheus#5118
* [FEATURE] Add silence annotations. prometheus#4965
* [FEATURE] Add silence logging option. prometheus#4163
* [FEATURE] Add support for multiple matcher set silences. prometheus#4957
* [FEATURE] Add the reason for notifying in dedup stage. prometheus#4971
* [FEATURE] mattermost: Flatten attachments into top-level config. prometheus#5009
* [FEATURE] mattermost: Support global webhook url. prometheus#4998
* [FEATURE] slack: Add default color from template. prometheus#5014
* [FEATURE] slack: Allow receiver to edit existing messages. prometheus#5007
* [FEATURE] template: Add dict, map and append functions. prometheus#5093
* [FEATURE] webhook: Add full payload templating support for notifier. prometheus#5011
* [BUGFIX] config: Check for empty cluster tls client config. prometheus#5126
* [BUGFIX] config: Don't crash upon reading empty config for notifier. prometheus#4979
* [BUGFIX] config: Fix ipv6 address handling in hostport.string(). prometheus#5040
* [BUGFIX] mattermost: Omit empty text field in notifications. prometheus#4985
* [BUGFIX] telegram: Send fallback message when notification exceeds character limit. prometheus#5074
* [BUGFIX] ui: Fix escaping for matcher values with quotes. prometheus#4862
* [BUGFIX] ui: Handle special chars in silence regex-matchers. prometheus#4942
* [BUGFIX] ui: Support utf-8 label names in matchers. prometheus#5089

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
@SoloJacobs SoloJacobs mentioned this pull request Apr 6, 2026
ultrotter pushed a commit that referenced this pull request Apr 7, 2026
* [CHANGE] `go get github.com/prometheus/alertmanager/ui` will now fail as compiled UI assets are no longer checked into the repository. Downstream builds that rely on these assets being present in the source tree must now build the UI from source. #5113
* [CHANGE] The '--enable-feature=auto-gomaxprocs' option is deprecated and will be removed in v0.33. This flag currently has no effect and can be safely removed from any startup scripts. #5090
* [CHANGE] Update internal function signatures across multiple packages. This affects any project that integrates `Alertmanager` code.
* [ENHANCEMENT] Add static asset caching. #5113
* [ENHANCEMENT] Reduce memory allocations through pre-sizing collections and batch allocation. #5020
* [ENHANCEMENT] Replace help with documentation in navigation bar. #4943
* [ENHANCEMENT] docs(ha): Update high availability documentation. #5136
* [ENHANCEMENT] docs: Add `auth_secret_file` for smtp in document. #5036
* [ENHANCEMENT] docs: Add description for global `telegram_bot_token`. #5114
* [ENHANCEMENT] docs: Add note about notifier timeouts. #5077
* [ENHANCEMENT] docs: Fix `force_implicit_tls` config field name. #5030
* [ENHANCEMENT] docs: Link community supported integrations. #4978
* [ENHANCEMENT] docs: Remove duplicate header. #5034
* [ENHANCEMENT] docs: Update mutual tls reference in high availability documentation. #5120
* [ENHANCEMENT] tracing: Use noop spans when tracing disabled. #5118
* [FEATURE] Add silence annotations. #4965
* [FEATURE] Add silence logging option. #4163
* [FEATURE] Add support for multiple matcher set silences. #4957
* [FEATURE] Add the reason for notifying in dedup stage. #4971
* [FEATURE] mattermost: Flatten attachments into top-level config. #5009
* [FEATURE] mattermost: Support global webhook url. #4998
* [FEATURE] slack: Add default color from template. #5014
* [FEATURE] slack: Allow receiver to edit existing messages. #5007
* [FEATURE] template: Add dict, map and append functions. #5093
* [FEATURE] webhook: Add full payload templating support for notifier. #5011
* [BUGFIX] config: Check for empty cluster tls client config. #5126
* [BUGFIX] config: Don't crash upon reading empty config for notifier. #4979
* [BUGFIX] config: Fix ipv6 address handling in hostport.string(). #5040
* [BUGFIX] mattermost: Omit empty text field in notifications. #4985
* [BUGFIX] telegram: Send fallback message when notification exceeds character limit. #5074
* [BUGFIX] ui: Fix escaping for matcher values with quotes. #4862
* [BUGFIX] ui: Handle special chars in silence regex-matchers. #4942
* [BUGFIX] ui: Support utf-8 label names in matchers. #5089

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
@ghost
Copy link
Copy Markdown

ghost commented Apr 14, 2026

Hey @Spaceman1701, I’ve tested the silence annotations feature in Alertmanager and it looks like it’s available via the API but not exposed in the UI. Are there any plans to support this in the UI as well?

@TheMeier
Copy link
Copy Markdown
Contributor

TheMeier commented Apr 15, 2026

Hey deleted user :)

There is already a UI change implemented and merged, it will become available with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants