diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/newos4-feedback-collect.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/newos4-feedback-collect.py b/scripts/newos4-feedback-collect.py index e73238c..226a74c 100755 --- a/scripts/newos4-feedback-collect.py +++ b/scripts/newos4-feedback-collect.py @@ -16,6 +16,7 @@ TRIAGE = os.path.join(ROOT, 'admin/docs/newos4-triage-latest.json') STEER = os.path.join(ROOT, 'spaces/newos4/data/maintenance/steering.json') DECISIONS = os.path.join(ROOT, 'spaces/newos4/data/feedback/decisions.jsonl') APPLIED = os.path.join(ROOT, 'spaces/newos4/data/feedback/applied.json') # ledger written by the applier +NETFAIL = os.path.join(ROOT, 'spaces/newos4/data/debug/network_failures.json') # ingest-filter counter def load(path, default): @@ -131,7 +132,12 @@ def main(): plans = plans_needing_decision(dec) reports = reports_needing_decision(dec) awaiting = [x for x in plans + reports if not x.get('decision')] + net = load(NETFAIL, {}) or {} + net_top = sorted(((net.get('by_source') or {}) if isinstance(net.get('by_source'), dict) else {}).items(), + key=lambda kv: -int(kv[1]))[:3] doc = { + 'network_failures': {'day': net.get('day'), 'total': int(net.get('total') or 0), + 'top': [[str(k), int(v)] for k, v in net_top]}, 'generated_at': datetime.now(timezone.utc).isoformat(timespec='seconds'), 'counts': { 'plans_review': len(plans), 'reports_total': len(reports), |