feat(dispatch): add alert markers per group#5047
Open
siavashs wants to merge 4 commits intoprometheus:mainfrom
Open
feat(dispatch): add alert markers per group#5047siavashs wants to merge 4 commits intoprometheus:mainfrom
siavashs wants to merge 4 commits intoprometheus:mainfrom
Conversation
cece42d to
b5e2104
Compare
This change adds alert markers to the aggregation groups in dispatcher. Alert markers replace the global marker and are used to track the state of alerts in each aggregation group. This change touches many components of the alertmanager. Per Group alert markers are passed to the notifiers and then inhibitor and silencer using context. The API has no breaking changes: - /alerts uses a temporary marker to track the state of alerts - /alerts/groups returns the group markers The metrics are also updated to use group markers. The `alertmanager_alerts` metric is moved to dispatcher. The `alertmanager_marked_alerts` metric is removed. By default it behaves the same as before, by aggregating all alerts in the groups. Enabling `group-key-in-metrics` flag will cause the metrics to be grouped by `group_key`. Signed-off-by: Siavash Safi <siavash@cloudflare.com>
b5e2104 to
b4055cb
Compare
MichaHoffmann
approved these changes
Feb 25, 2026
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
siavashs
commented
Feb 25, 2026
Comment on lines
+380
to
+383
| alertGroup.AlertStatuses = make(map[model.Fingerprint]alert.AlertStatus, len(filteredAlerts)) | ||
| for _, a := range filteredAlerts { | ||
| alertGroup.AlertStatuses[a.Fingerprint()] = ag.marker.Status(a.Fingerprint()) | ||
| } |
Contributor
Author
There was a problem hiding this comment.
See this analysis https://app.devin.ai/review/prometheus/alertmanager/pull/5047
Basically Groups() now uses the per-group alert marker to report status to /alerts/groups api call.
But /alerts uses a tempMarker to replicate a global marker for backwards compatibility.
This results in the 2 API endpoint to not return exactly the same results:
/alertswill keep "predicting" the future (like it did before), to say if an alert will be muted if dispatched now (we want to remove statuses from here in API v3 probably)/alerts/groupsshows the current true status without using "prediction", this is different than before I think
We can use a tempMarker for /alerts/groups to keep predicting the future.
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
Signed-off-by: Siavash Safi <siavash@cloudflare.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds alert markers to the aggregation groups in dispatcher.
Alert markers replace the global marker and are used to track the state of alerts in each aggregation group.
This change touches many components of the alertmanager.
Per Group alert markers are passed to the notifiers and then inhibitor and silencer using context.
The API has no breaking changes:
The metrics are also updated to use group markers.
The
alertmanager_alertsmetric is moved to dispatcher.The
alertmanager_marked_alertsmetric is removed.By default it behaves the same as before, by aggregating all alerts in the groups.
Enabling
group-key-in-metricsflag will cause the metrics to be grouped bygroup_key.Pull Request Checklist
Please check all the applicable boxes.
Which user-facing changes does this PR introduce?