diff options
Diffstat (limited to 'scripts/newos4-triage.py')
| -rwxr-xr-x | scripts/newos4-triage.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/newos4-triage.py b/scripts/newos4-triage.py index ef05dc1..651b94d 100755 --- a/scripts/newos4-triage.py +++ b/scripts/newos4-triage.py @@ -16,6 +16,15 @@ STATE_DIR = '/var/lib/webx11/newos4-maintenance' STATE = os.path.join(STATE_DIR, 'state.json') NOISE = re.compile(r'(user aborted|aborted without reason|signal timed out|AbortError|TimeoutError)', re.I) +# api/debug/report.php refuses network-class auto reports and the supervisor skips aborts by design, +# so these can never become a card. Ranking them by count taught the operator to ignore top_real: +# 18 203 / 16 540 / 13 407 / 423 sat above the only action-able runtime error (989). Measured 2026-11-02. +UNFILEABLE = re.compile(r'(failed to fetch|fetch failed|networkerror|load failed|' + r'aborted without reason|signal timed out|err_network)', re.I) + + +def is_unfileable(msg): + return bool(UNFILEABLE.search(str(msg or ''))) SELF = re.compile(r'/api/debug/(ingest|report)\.php', re.I) @@ -156,7 +165,14 @@ def build(apply_fix=False): ({'message': safe(e.get('message'), 200), 'type': e.get('type'), 'count': int(e.get('count') or 1), 'age_hours': age_hours(e.get('last_seen')), 'frame': safe(e.get('frame'), 160), - 'session': safe(e.get('session_id'), 40)} for e in buckets['real']), + 'session': safe(e.get('session_id'), 40)} for e in buckets['real'] + if not is_unfileable(e.get('message'))), + key=lambda x: -x['count'])[:10], + # Ranked separately: these can never become a card (policy), so they are not "top real". + 'policy_noise': sorted( + ({'message': safe(e.get('message'), 200), 'type': e.get('type'), + 'count': int(e.get('count') or 1), 'age_hours': age_hours(e.get('last_seen'))} + for e in buckets['real'] if is_unfileable(e.get('message'))), key=lambda x: -x['count'])[:10], 'new_reports': [{'id': r.get('id'), 'title': safe(r.get('title'), 160), 'created_at': r.get('created_at'), |