feat(alerting): add quiet hours to alert groups
This commit is contained in:
1 parent
bf529a7711
commit
ee3769f578
21 files changed
+1310
-130
No files matched your search
@@ -97,10 +97,25 @@ func (s *Server) transition(ctx context.Context, m store.MonitorsForResultsRow,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
channels, err := q.MonitorChannelIDs(ctx, m.ID)
|
||||
routes, err := q.MonitorAlertRoutes(ctx, m.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
quiet := map[uuid.UUID]bool{}
|
||||
seen := map[uuid.UUID]bool{}
|
||||
var channels []uuid.UUID
|
||||
for _, r := range routes {
|
||||
muted, ok := quiet[r.GroupID]
|
||||
if !ok {
|
||||
muted = isQuietRawAt(r.QuietHours, at)
|
||||
quiet[r.GroupID] = muted
|
||||
}
|
||||
if muted || seen[r.ChannelID] {
|
||||
continue
|
||||
}
|
||||
seen[r.ChannelID] = true
|
||||
channels = append(channels, r.ChannelID)
|
||||
}
|
||||
for _, ch := range channels {
|
||||
if err := q.EnqueueNotification(ctx, store.EnqueueNotificationParams{OrgID: m.OrgID, ChannelID: ch, IncidentID: inc.ID, Event: event}); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user