Log incidents even when alerts are muted
This commit is contained in:
@@ -47,14 +47,22 @@ async def notify(
|
||||
category: str | None = None,
|
||||
):
|
||||
alerts_cfg = cfg.get("alerts", {})
|
||||
suppressed_reason = None
|
||||
if category and is_muted(category):
|
||||
return
|
||||
if category and is_auto_muted(cfg, category):
|
||||
return
|
||||
if _in_quiet_hours(alerts_cfg):
|
||||
suppressed_reason = "muted"
|
||||
elif category and is_auto_muted(cfg, category):
|
||||
suppressed_reason = "auto_mute"
|
||||
elif _in_quiet_hours(alerts_cfg):
|
||||
allow_critical = bool(alerts_cfg.get("quiet_hours", {}).get("allow_critical", True))
|
||||
if not (allow_critical and level == "critical"):
|
||||
return
|
||||
suppressed_reason = "quiet_hours"
|
||||
|
||||
if suppressed_reason:
|
||||
try:
|
||||
log_incident(cfg, f"[suppressed:{suppressed_reason}] {text}", category=category)
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
dedup_sec = int(alerts_cfg.get("notify_cooldown_sec", alerts_cfg.get("cooldown_sec", 900)))
|
||||
if dedup_sec > 0:
|
||||
|
||||
Reference in New Issue
Block a user