Files
Raja SubramanianandClaude Opus 5.5 f8d04f4439 telemetry: count failed publishes and subscribes, not only successes (#5311)
* telemetry: count failed publishes and subscribes, not only successes

- JoinSession records a publish request before each re-reported track.
- livekit_track_publish_counter gets state="failure" for tracks pending at close.
- A subscribe failure is counted once per attempt; a new attempt restarts its timers.
- livekit_track_subscribe_counter gets a user_error label.
- New livekit_pubsub_outcome_ms: one sample per attempt, failures at the time they fail.
- A connection that never comes up records its session start time at close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* telemetry: close the gaps in failure samples found in review

- A subscribe that succeeds after a user-error wait starts a new attempt.
- Close records one publish failure sample per pending request, migrated ones included.
- A publish released for an unknown codec counts as a failed publish.
- A session that never reached primary transport connected records its start time at close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* telemetry: start the new attempt when a bind lands before subscribe returns

After a user error, a bind that fired inside addSubscriber found the
outcome gate still closed and recorded no success sample. The bind
callback now starts the new attempt too, and the test waits for the
request count instead of reading it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* telemetry: serialize the new attempt and record legacy publish time per request

The bind callback and reconcile could both reach the new-attempt helper.
The one that lost the flag swap returned before the timers restarted, so
a later reconcile could fire a false not-bound timeout. A per-subscription
mutex now holds the whole restart.

On a close that is not a cancel, livekit_pubsubtime_ms now records one
publish sample for each pending request, migrated requests included, the
same set the failure counter and livekit_pubsub_outcome_ms cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 19:54:48 +05:30
..