droboticflow/internal/domain/client_telemetry.go
d-robotics 54e47906c1 🎬 movi-player D-layer: vendor 0.4.1 slim dist, MoviVideo wrapper on E′ direct pipeline, telemetry endpoint, spikes pass
- vendor public/vendor/movi-player-0.4.1/ (element.slim.js 4.9MB + movi.wasm 5.4MB,
  Apache-2.0, SHA-256 pinned, upgrade = new versioned dir + MOVI_VERSION bump)
- src/lib/movi-player.ts: lazy loader (@vite-ignore dynamic import), runtime
  force flag (movi default / native fleet kill-switch / wasm canary), throttled
  best-effort telemetry reporter
- src/components/MoviVideo.tsx: engine="native wasm" + nohotkeys, HTMLMediaElement
  event bridge, #t= fragment split (startat + wrapper-managed end bound),
  in-place custom-element upgrade preserving node identity, wasmurl before connect
- mount points: LazyVideoPreview (evidence/artifact/object-storage previews),
  MaterializedSliceWorkbench dual-camera, CaptureAnnotationWorkbench main videos
  (moviElementReady gate: transport seek queue needs the element on first render;
  falls back to native E′ path until defined), page-level preload on
  AnnotationOperations
- POST /api/client/movi-stats: session-attributed, field-truncated, store errors
  swallowed (202); Mongo clientMoviStats collection w/ 14d TTL + org/kind indexes
- spikes (CDP, headless Edge 155, production hev1 480p30 sample): key conflicts
  PASS (17 keys all reach container dispatcher, zero playback-state interference,
  nohotkeys effective); frame-seek parity PASS (movi deltas identical to native
  <video>, ±1/30s steps both directions); deep probe: engine=native-wasm hands
  playback to shadow <video> with zero WASM fetches on HW-decode clients
- verification: tsc clean, gofmt/build/vet pass, frontend 644 tests net-zero new
  failures vs E′ baseline (6 new pass), Go API suite net-zero new failures
  (75 pre-existing; the one delta traced to a colleague's uncommitted part-index
  working-tree change), replica E2E: vendor assets served, module registers,
  telemetry lands in Mongo with TTL
2026-10-11 20:06:22 +05:30

33 lines
1.8 KiB
Go

package domain
import "time"
// ClientMoviStatRecord is one browser-player telemetry sample reported by the
// frontend (src/lib/movi-player.ts). The fleet survey reads these to answer:
// which decoding layer actually carries playback (native element vs WebCodecs
// hardware vs FFmpeg-WASM software), how often fallbacks and errors occur, and
// whether any client cannot play the direct presigned stream at all.
type ClientMoviStatRecord struct {
ID string `json:"id" bson:"_id"`
OrganizationID string `json:"organizationId" bson:"organizationId"`
UserID string `json:"userId" bson:"userId"`
Kind string `json:"kind" bson:"kind"`
Decoder string `json:"decoder,omitempty" bson:"decoder,omitempty"`
Engine string `json:"engine,omitempty" bson:"engine,omitempty"`
Src string `json:"src,omitempty" bson:"src,omitempty"`
StartupMs *int64 `json:"startupMs,omitempty" bson:"startupMs,omitempty"`
DroppedFrames *int64 `json:"droppedFrames,omitempty" bson:"droppedFrames,omitempty"`
RebufferRatio *float64 `json:"rebufferRatio,omitempty" bson:"rebufferRatio,omitempty"`
Message string `json:"message,omitempty" bson:"message,omitempty"`
Fatal bool `json:"fatal,omitempty" bson:"fatal,omitempty"`
Smooth *bool `json:"smooth,omitempty" bson:"smooth,omitempty"`
UserAgent string `json:"userAgent,omitempty" bson:"userAgent,omitempty"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
ExpireAt time.Time `json:"expireAt" bson:"expireAt"`
}
// ClientMoviStatRetention bounds how long samples stay queryable. Two weeks
// covers the post-release survey window with margin; the TTL index removes
// expired documents automatically.
const ClientMoviStatRetention = 14 * 24 * time.Hour