Skip to content

Add realtime observability logging - #29

Draft
VerioN1 wants to merge 13 commits into
mainfrom
alon/observability-logs
Draft

Add realtime observability logging#29
VerioN1 wants to merge 13 commits into
mainfrom
alon/observability-logs

Conversation

@VerioN1

@VerioN1 VerioN1 commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds realtime observability forwarding so selected client diagnostics and WebRTC stats are sent through the signaling websocket while preserving the existing HTTP telemetry behavior where appropriate.

Changes

  • Forward allowed LiveKit connection diagnostics over the realtime websocket.
  • Add network path and candidate-pair observability payload support.
  • Keep log forwarding and stats transport behavior separated by event kind.
  • Add focused tests for websocket observability, HTTP telemetry, opt-out behavior, candidate pair stats, and diagnostic filtering.

Validation

  • swift test

VerioN1 and others added 13 commits May 28, 2026 14:27
- send WebRTC stats, diagnostics, and SDK logs to api/v1/telemetry
- filtered LiveKit warning/error forwarding via DecartLiveKitLogger
- replace ack polling loops with AsyncRequest continuations
- DecartUserAgent for User-Agent header parity with JS SDK
- configurable connection/media options on RealtimeConfiguration

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lures

Permanent connect failures and exhausted reconnects previously left logs
and diagnostics buffered indefinitely since the periodic flush only runs
after sessionStarted. Add flushPendingIfNeeded that synthesizes a
pre-session id and forces a drain, called on permanent failure, on
reconnect exhaustion, and before stopTelemetry in disconnect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Emit iceCandidatePairsState whenever the pair-state distribution
changes, capturing frozen/waiting/in-progress/failed counts even when
no pair has been nominated. Surfaces ICE checking progression for
sessions that never reach a selected pair.

Add NetworkPathObserver wrapping NWPathMonitor; emits networkPathChange
diagnostic on Wi-Fi/cellular/expensive/constrained transitions for the
lifetime of the manager.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The api-platform telemetry route validates diagnostics[] with a strict
discriminatedUnion on `name`. iOS was emitting names not in the union
(iceCandidatePair, iceCandidatePairsState, networkPathChange,
generationStarted) and an invalid client-session-connection-breakdown
shape, so zod rejected the whole payload and the route silently
returned 204 — logs[] never reached Datadog.

- drop the unsupported diagnostic emissions for now
- filter emitLog/recordLog and the LiveKit forwarder to .error only
- convert path-unsatisfied transitions to an error-level log entry
- remove the redundant remote-track stats poll (local share peer conn)
- drop the "LiveKit reconnect completed" info-level log

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match the JavaScript SDK's realtime observability contract so client-side
connection diagnostics land in Datadog under the same names and shapes:

- Replace per-phase phaseTiming with a consolidated
  client-session-connection-breakdown diagnostic using the JS phase names
  (websocket-open, room-join, initial-state-handshake, webrtc-handshake,
  publish-local-track), and add the reconnect diagnostic.
- Forward selected-candidate-pair (winning ICE pair) derived from the WebRTC
  stats collector, recovering ICE visibility despite Swift LiveKit not
  exposing the underlying peer connections.
- Rename network/room instrumentation events to the JS contract
  (network-state/-change, browser-online/-offline, room-connected/
  -disconnected/-reconnecting/-reconnected); drop non-parity events.
- Keep logs local-only and keep periodic stats off the WS, matching JS.
- Decouple network-path monitoring from the observability forwarder; start
  and stop it explicitly around a session.

Tests: 37 passing (swift test).
Co-authored-by: Cursor <cursoragent@cursor.com>
- Configure LiveKit for a video-only session so the microphone is never
  engaged and audio is never routed to the speaker: force a playback-only
  AVAudioSession category and disable the audio engine before connecting.
  This also fixes the crash on devices without NSMicrophoneUsageDescription.
- Stop publishing local audio and stop subscribing to remote audio.
- Example: mirror both the AI-processed remote view and the local PiP based
  on the active camera (front mirrored, back un-mirrored) and update live on
  camera switch.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant