Telemetry: errors and traces from the screens
The relay is an OpenTelemetry (OTLP/HTTP) receiver. The screens tell it what went wrong; the Manager shows it (Errors pane); later, traces go on to Logfire or a local backend. Built: step 1.
Step 1: errors into the Manager (built) #
POST /v1/logs: OTLP logs as JSON (ExportLogsServiceRequest). Warn (severity 13) and worse are kept; the rest are dropped. Needs the household token like every route (401 without), andContent-Type: application/json(415 for protobuf: not read yet; the Swift screens send JSON, and a Go sender needs its JSON option or a collector in front). Bodies over 4 MB: 413. Not JSON, or not logs: 400.POST /v1/traces: accepted and dropped for now (200{}), so a sender can be pointed at the relay before anything listens.- A screen's report doesn't count as what it "last asked" in the Relay pane.
- Device and area. A record's device is
device.name(elsehost.name,service.instance.id, else theX-RetroTV-Screenheader); its area is theretro.areaattribute, else the scope name.retro.detail(orexception.stacktrace) is its detail. - Store (
station.sqlite,tower/internal/store/errors.go,*store.Store.RecordErrors; HTTP intake intower/internal/relay/otlp.goviaotlpRoutes/decodeOTLP): one row per device, area and message, with a count and first and last seen; the most recent 2,000 kept (errorCapacity = 2000). Every Manager is a remote client and reads errors overGET /v1/admin/errors(Packages/Sources/ManagerUI/ErrorsPane.swift), and the assistant reads them viaget_errors(tower/internal/tools/health.go). - Screens report with
Telemetry.report("playback", "…", detail:, warning:)(Packages/Sources/StationCore/Relay/Telemetry.swift): batched for a couple of seconds, held (up to 100) while no relay answers, never in the way of playback. All screens push viaPOST /v1/logs. - Redaction happens on the device, before a record exists (
Redactand the OTLP value typesErrorReport,OTLPLogs,ErrorEvent,ReportStatus,ProblemReport,NewReportinPackages/Sources/RetroLineup/Telemetry.swift): a login in an address (/movie/<user>/<pass>/…,user:pass@),username=/password=/token=parameters, the rest of an address's query, and any known login's username and password wherever they appear. - First emitters: On Demand playback: AVPlayer wouldn't open a file (a warning, as VLC takes over), and a file neither player would open.
- This is separate from the Playback Diagnostics pane, which pulls a screen's playback samples from it over Bonjour; this pushes problems to the relay.
Reports (store and admin API built; screens can't file them yet) #
A person's "this is wrong" from a screen, kept in the same file as errors
(station.sqlite) but in its own table. Not mixed into errors: those rows are
counted, capped at 2,000 and cleared; a report is one event with a payload,
kept until dealt with.
- Schema is versioned (
PRAGMA user_version,migrationsintower/internal/store/store.go): entries are only ever appended, a database from a newer tower is refused rather than run over, and each step is one transaction. WAL, foreign keys on and a busy timeout are set on open. reportsis STRICT, with checks: device and reason non-empty,statusone of open/resolved/dismissed,contextvalid JSON and an object, andresolved_atset exactly when the report isn't open. Times are unix seconds. Indexed by (status, created) and by channel. Not linked toerrors(they are pruned); what was happening is snapshotted intocontext.- Toggling: resolve, dismiss or reopen (reopening clears the closing time and keeps the note). Closed reports go 90 days after they were closed; open ones never. Clearing errors leaves reports alone. A context over 256 KB is refused rather than cut.
- Admin API (
/v1/admin, the client key; see api/README.md,tower/internal/admin/reports.go, and historical notes in history/remote-management.md):GET errors,GET reports?status=&limit=(no context),GET reports/<id>(with it),PUT reports/<id>{status, note}. Every Manager is paired to Antenna Tower and sees its errors and reports. - Not built: a screen filing one (
POST /v1/reports, household token, redacted on the device), the Manager's Reports pane, and an MCP tool.
Step 2: the toggle (not built) #
A synced setting in the Manager: off, errors only, full traces. Off creates no spans (no cost). Errors stay on at low volume.
Step 3: traces (not built) #
Spans on playback, provider calls and relay jobs, sent to the tower's
/v1/traces and forwarded by an OpenTelemetry Collector on the tower's host
to Logfire or a local Tempo/Jaeger. The Logfire token lives on that host, never
on a screen. Addresses are redacted as for errors.
Phin Tech docs
Rabbit Ears Manager in the store →