diff --git a/frontend/src/app.html b/frontend/src/app.html
index 3d39fbc..440156d 100644
--- a/frontend/src/app.html
+++ b/frontend/src/app.html
@@ -42,7 +42,7 @@
function report(reason) {
if (sent) return; sent = true; // one beacon per page
try {
- var b = new Blob([JSON.stringify({ reason: String(reason || 'unknown').slice(0, 300),
+ var b = new Blob([JSON.stringify({ reason: String(reason || 'unknown').slice(0, 500),
path: location.pathname })], { type: 'application/json' });
navigator.sendBeacon && navigator.sendBeacon('/api/client-error', b);
} catch (e) { /* best-effort telemetry */ }
@@ -73,6 +73,16 @@
if (nav && nav.responseStart) detail += ' (html ' + Math.round(nav.responseStart) + 'ms)';
if (navigator.connection && navigator.connection.effectiveType)
detail += ' on ' + navigator.connection.effectiveType;
+ // Name the culprits: the 3 slowest resource fetches so far, with
+ // start→end so gaps (idle/SW churn) are distinguishable from slow
+ // downloads. size=0 usually means it came from the SW/cache.
+ var res = (performance.getEntriesByType('resource') || [])
+ .slice().sort(function (a, b) { return b.duration - a.duration; }).slice(0, 3)
+ .map(function (r) {
+ var name = r.name.replace(location.origin, '').slice(0, 80);
+ return name + ' ' + Math.round(r.startTime) + '→' + Math.round(r.responseEnd) + 'ms sz' + (r.transferSize || 0);
+ });
+ if (res.length) detail += ' | slowest: ' + res.join(' ; ');
report(detail);
}
} catch (e) { /* timing is best-effort */ }
diff --git a/goodnews/api.py b/goodnews/api.py
index 47a80c9..c68e3fc 100644
--- a/goodnews/api.py
+++ b/goodnews/api.py
@@ -948,7 +948,7 @@ def create_app() -> FastAPI:
with get_conn() as conn:
conn.execute(
"INSERT INTO client_errors (reason, path, user_agent, app_version) VALUES (?, ?, ?, ?)",
- ((body.reason or "")[:300], (body.path or "")[:200], ua, (body.version or "")[:60]),
+ ((body.reason or "")[:500], (body.path or "")[:200], ua, (body.version or "")[:60]),
)
conn.execute("DELETE FROM client_errors WHERE created_at < datetime('now','-14 days')")
conn.commit()