Add Opsgenie alias field for alert deduplication - #1292
Merged
Conversation
Set the alias field on Opsgenie alerts using a SHA-256 hash of the involved object's Kind, Namespace, Name, and event Reason. This allows Opsgenie to deduplicate repeated alerts for the same source instead of creating new pages for each firing. Fixes fluxcd#460 Signed-off-by: Cairon <cairon-ab@users.noreply.github.com>
Without the provider UID in the alias hash, alerts from different clusters sharing the same involved object (e.g. Kustomization/flux-system/flux-system) would produce identical aliases and Opsgenie would aggregate them into a single incident. Thread the ProviderUID from notifierOptions into the Opsgenie struct and prepend it to the alias hash input so each cluster's Provider resource produces a unique alias. Signed-off-by: cairon-ab <cairon-ab@users.noreply.github.com> Signed-off-by: Cairon <cairon-ab@users.noreply.github.com>
matheuscscp
force-pushed
the
opsgenie-alias-dedup
branch
from
August 7, 2026 11:18
f322c46 to
1a93ec3
Compare
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.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.
Summary
Set the
aliasfield on Opsgenie alerts using a SHA-256 hash of the involved object's Kind, Namespace, Name, and event Reason. This allows Opsgenie to deduplicate repeated alerts for the same source instead of creating new pages for each firing.Changes
Aliasfield toOpsgenieAlertstruct withjson:"alias,omitempty"generateOpsgenieAlias()function that creates a deterministic SHA-256 hash from the event'sInvolvedObject.Kind,InvolvedObject.Namespace,InvolvedObject.Name, andReasonPost()so every alert carries a stable aliasTestOpsgenie_PostAlias(verifies alias in HTTP payload across multiple scenarios) andTestGenerateOpsgenieAlias(determinism, length, uniqueness)Why
Currently, Opsgenie creates a new alert for every notification event, even when it's for the same object and reason. The Opsgenie Alert API supports an
aliasfield that acts as a deduplication key — alerts with the same alias are grouped as a single incident.By hashing
Kind/Namespace/Name/Reason, we ensure:ReconciliationFailedvsHealthCheckFailed) create separate alertsFixes #460