Skip to content
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

Admin: fix a discrepancy in the generated alert YAML #4506

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions admin/server/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ func (s *Server) yamlForManagedAlert(opts *adminv1.AlertOptions, ownerUserID str
// Hard code the user id to run for (to avoid exposing data through alert creation)
res.Query.For.UserID = ownerUserID
// Notification options
res.Notify.Renotify = opts.Renotify
res.Notify.RenotifyAfter = opts.RenotifyAfterSeconds
res.Renotify = opts.Renotify
res.RenotifyAfter = opts.RenotifyAfterSeconds
res.Notify.Email.Emails = opts.EmailRecipients
res.Notify.Slack.Channels = opts.SlackChannels
res.Notify.Slack.Users = opts.SlackUsers
Expand Down Expand Up @@ -494,8 +494,8 @@ func (s *Server) yamlForCommittedAlert(opts *adminv1.AlertOptions) ([]byte, erro
res.Query.Name = opts.QueryName
res.Query.Args = args
// Notification options
res.Notify.Renotify = opts.Renotify
res.Notify.RenotifyAfter = opts.RenotifyAfterSeconds
res.Renotify = opts.Renotify
res.RenotifyAfter = opts.RenotifyAfterSeconds
res.Notify.Email.Emails = opts.EmailRecipients
res.Notify.Slack.Channels = opts.SlackChannels
res.Notify.Slack.Users = opts.SlackUsers
Expand Down Expand Up @@ -585,22 +585,17 @@ type alertYAML struct {
UserID string `yaml:"user_id"`
} `yaml:"for"`
} `yaml:"query"`
Email struct {
Recipients []string `yaml:"recipients"`
Renotify bool `yaml:"renotify"`
RenotifyAfter uint32 `yaml:"renotify_after"`
} `yaml:"email"`
Notify struct {
Renotify bool `yaml:"renotify"`
RenotifyAfter uint32 `yaml:"renotify_after"`
Slack struct {
Renotify bool `yaml:"renotify"`
RenotifyAfter uint32 `yaml:"renotify_after"`
Notify struct {
Email struct {
Emails []string `yaml:"emails"`
}
Slack struct {
Users []string `yaml:"users"`
Channels []string `yaml:"channels"`
Webhooks []string `yaml:"webhooks"`
}
Email struct {
Emails []string `yaml:"emails"`
}
}
Annotations alertAnnotations `yaml:"annotations,omitempty"`
}
Expand Down
Loading