File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -197,13 +197,16 @@ async def process_zenduty_events(self, current_time):
197
197
to_remove .append (identifier )
198
198
# Raise alert if failed > $threshold times within the last 5m window
199
199
# or if already alerted and not yet resolved.
200
- # Re-alert every 5 minutes but not more often.
200
+ # Re-alert at the start of each hour but not more often.
201
201
elif (
202
202
info ["failures" ] >= alert_threshold or (info ["sent" ] and not resolved )
203
203
) and (
204
- not info .get ("last_alert" )
205
- or current_time - datetime .fromisoformat (info ["last_alert" ])
206
- > timedelta (minutes = 5 )
204
+ not info .get ("last_alert" ) # First alert - send immediately
205
+ or ( # Subsequent alerts - send at the start of each hour
206
+ current_time - datetime .fromisoformat (info ["last_alert" ])
207
+ > timedelta (minutes = 5 )
208
+ and current_time .minute == 0 # Only alert at the start of each hour
209
+ )
207
210
):
208
211
logger .debug (f"Raising Zenduty alert { identifier } " )
209
212
self .open_alerts [identifier ]["sent" ] = True
You can’t perform that action at this time.
0 commit comments