diff --git a/services/notify.py b/services/notify.py index 1fcba34..eb72260 100644 --- a/services/notify.py +++ b/services/notify.py @@ -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: