WAN degraded: a modem restart resets the judgement
Lint / JS (eslint) (push) Successful in 10s
Lint / Python (flake8) (push) Successful in 49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Python (flake8) (pull_request) Successful in 50s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (push) Successful in 1m8s
Test / Python Tests (pytest) (push) Successful in 1m21s
Security / Python Security (bandit) (pull_request) Successful in 1m5s
Test / Python Tests (pytest) (pull_request) Successful in 1m31s

Only health periods from 15 minutes after the latest restart count, so a
slowdown the restart fixed neither opens a ticket on deploy nor holds one
open. Replay: opens 11-24 01:30, resolves 04:20 after the reboot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-23 23:52:27 -05:00
1 parent a31437f2e5
commit 3e3069d2aa
4 files changed
+19 -2

No files matched your search

+7 -1
View File
@@ -2099,13 +2099,19 @@ class NetworkMonitor:
if not periods:
return # nothing fresh to judge by: leave any open alert as it is
newest = periods[-1]['ts']
episodes, lines, hint = self._restart_context(time.time())
if episodes:
# A restart resets the judgement: only what came after it (once it has settled)
# counts, so a slowdown it fixed neither opens a ticket nor holds one open.
periods = [p for p in periods if p['ts'] >= episodes[-1]['at'] + modem_api.RESTART_SETTLE_S]
if not periods:
return
fraction = float((self.cfg.get('modem') or {}).get('degraded_fraction', modem_api.DEGRADED_FRACTION))
bad = modem_api.degradation(periods, newest, fraction)
if bad is None:
if modem_api.recovered(periods, newest):
db.resolve_event('wan_degraded', self.modem_name, '')
return
episodes, lines, hint = self._restart_context(time.time())
parts = [f'{bad[s]} {s}' for s in ('latency', 'loss', 'down') if bad[s]]
description = (f'The internet has been degraded for most of the last 2 hours: {bad["bad"]} of '
f'{bad["total"]} five-minute periods had {", ".join(parts)} (UniFi WAN health).')