Skip to content

Commit

Permalink
Admin: fix a discrepancy in the generated alert YAML (#4506)
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller authored Apr 3, 2024
1 parent 17e1aa3 commit c845cc1
Showing 1 changed file with 11 additions and 16 deletions.
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

0 comments on commit c845cc1

Please sign in to comment.