feat(play): add error observability analytics for mobile diagnostics

Track play_error and play_visibility_lost events via Umami to
distinguish mobile vs desktop failure modes. Each error event
captures orientation, connection type, visibility state, elapsed
time bucket, and error classification — all categorical, no free
text. Includes postJson "HTTP \d+" status parsing for the new
engineClient dual-path architecture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
yuanzonghao
2026-06-13 18:57:38 +08:00
parent b069313014
commit 0998f7c46a
2 changed files with 121 additions and 2 deletions
+14
View File
@@ -54,6 +54,20 @@ type AnalyticsEventData = {
fullscreen_toggle: { on: boolean };
play_heartbeat: never;
gallery_export: { scene_count: number; audio_count: number };
play_error: {
source: "scene" | "start" | "vision" | "insert_beat" | "freeform" | "prefetch";
kind: "network" | "timeout" | "http_5xx" | "http_4xx" | "abort" | "unknown";
http_status: number;
orientation: "portrait" | "landscape";
connection: "4g" | "3g" | "2g" | "slow-2g" | "unknown";
was_hidden: boolean;
scene_index: number;
elapsed_bucket: "<5s" | "5-30s" | "30-60s" | "60-120s" | "120s+";
};
play_visibility_lost: {
phase: "loading-first" | "ready" | "transitioning" | "vision-thinking" | "inserting-beat";
had_pending_fetch: boolean;
};
};
export type AnalyticsEvent = keyof AnalyticsEventData;