New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alerting: In migration, create one label per channel #76527
Merged
JacobsonMT
merged 8 commits into
main
from
jacobsonmt/migration_improve_contact_point_creation
Dec 19, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
57c55d3
In migration, create one label per channel using UID instead of name
JacobsonMT 2642ae1
Address PR review comments
JacobsonMT 36719bd
Error to Warn log when notification id has no associated uid
JacobsonMT a959711
Fix small bug where folder permissions were calculated too often
JacobsonMT 4a69987
Use channel names in label instead of uids
JacobsonMT 79bbacf
Modify routing labels to start with the same prefix __legacy
JacobsonMT ac05217
Fix rebase conflict
JacobsonMT 218cd04
Fix linting
JacobsonMT File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this answers my question above: we are going to drop a notification without UID. I wonder what is the reason for such decision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically a simplified version of how it works in legacy alerting, see
grafana/pkg/services/alerting/rule.go
Lines 170 to 190 in 00d9543
At least one of the
id
oruid
is guaranteed to be present on each entry ofparsedSettings.Notifications
. So, we performa cached lookup of the UID for a given ID, or use the UID if one exists.There was a point in time a while ago where UIDs didn't exist for notification channels, but we are guaranteed to have one now since we run after sqlstore migrations (specifically
grafana/pkg/services/sqlstore/migrations/alert_mig.go
Lines 187 to 190 in 2212c6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If neither
id
notuid
is present on the entry, or if theid
is invalid, then that legacy alert would be failing to send to the channel in legacy alerting anyways.