APP-14871: Report WebRTC connection metadata after dialing#185
Draft
Daniel Botros (danielbotros) wants to merge 1 commit into
Draft
APP-14871: Report WebRTC connection metadata after dialing#185Daniel Botros (danielbotros) wants to merge 1 commit into
Daniel Botros (danielbotros) wants to merge 1 commit into
Conversation
Port of the Go SDK's WebRTC dial telemetry (goutils#583) for the Python/C++ SDKs. After a WebRTC dial finishes — success or failure — the client best-effort reports to the signaling server it dialed through: the furthest dial stage reached, the gRPC failure code, the dial duration, how the dial was signaled (cloud vs local), the selected ICE candidate pair per side (host/stun/relay + relay address), and the SDK type/version. Proto stubs generated from the goutils PR branch; regenerate with `make buf` once goutils#583 lands on the BSR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
APP-14871 Track coturn usage / WebRTC client connection telemetry — the Python/C++ SDK (rust-utils) port of the Go SDK's dial telemetry in goutils #583. App-side receiver in app #11316.
Depends on goutils #583: the
SignalingService.ReportConnectionMetadataproto additions. The committedsrc/genstubs were generated from that PR's branch; once it merges and publishes to the BSR,make bufreproduces them.Client (
maybe_connect_via_webrtc) — after a WebRTC dial succeeds or fails, reports best-effort to the signaling server it dialed through:reached_stage: the furthest dial checkpoint, advanced as the dial progresses (SIGNALING_CONNECTED → CONFIG_FETCHED → OFFER_SENT → ANSWER_RECEIVED → ICE_CONNECTED → DTLS_CONNECTED → READY).READYmeans success; any earlier value is where a failed dial stopped. Tracked by a forward-only atomic (DialStageTracker) since checkpoints advance from the dial task, the ICE state callback, and the answer-processing task.local/remote: the selected ICE candidate pair classified per side as host / stun / relay from the peer connection stats (nominated + succeeded pair — webrtc-rs'sget_selected_candidate_pairis opaque). Relay candidates carry the relay address so app can attribute the provider (Viam coturn vs Twilio).failure_code: the tonic status code of a failed dial (first status in the error chain; non-gRPC failures map toUnknown). Set only on failure.signaling_path: classified from the signaling server address the channel actually dialed (app.viam.com/app.viam.dev→cloud_signaled, anything else →local). WebRTC is never dialed over mDNS here (mDNS connections are direct gRPC, RSDK-14026), somdns_localis never reported by this SDK.duration_ms(dial start → ready/failure) andsdk_type=python_cpp/sdk_version(the rust-utils crate version; the FFI layer cannot distinguish Python from C++ callers, hence the single combined type).src/rpc/dial_report.rs. The send is spawned detached with a 5s timeout so it never delays the caller — in particular a failed WebRTC dial's direct-connection fallback proceeds immediately.Reporting semantics vs Go — one report per WebRTC dial attempt, success or failure:
Canceledfailures from losing paths. rust-utils has no parallel WebRTC race (the mDNS branch never dials WebRTC), so there is nothing to dedup — a failed attempt's report is the signal, even when the dial then falls back to a direct gRPC connection. Suppressing on fallback success would hide nearly all WebRTC failures from Python/C++, since the fallback usually works.Unimplementedfailure (remote has no WebRTC signaler) is fallback control flow, not a WebRTC failure, and is never reported — mirroring Go'sErrNoWebRTCSignalerhandling.Tests — unit coverage in
dial_report.rsfor stage-tracker forward-only advancement, signaling-path classification, candidate/pair classification (host/stun/relay, relay address, no-pair, missing-candidate), and failure-code extraction.Testing
cargo build,cargo test --lib(10/10), clippy and rustfmt clean on touched files.tests/echo_test.rssuite (6/6 pass). Exactly oneReportConnectionMetadataper WebRTC dial,OKresponse.local/remote host↔host, sdk_type=python_cpp, reached_stage=READY, duration_ms=580, signaling_path=local, sdk_version=0.6.0.reached_stage=ANSWER_RECEIVED, failure_code=2 (Unknown), signaling_path=local, candidates unspecified.🤖 Generated with Claude Code