Skip to content

feat: forward and draw the SDK's join DAG (3RTT T01) - #689

Merged
tbarbugli merged 5 commits into
factory/3rttfrom
3rtt/t01-join-dag
Sep 30, 2026
Merged

tbarbugli merged 5 commits into
factory/3rttfrom
3rtt/t01-join-dag

Conversation

@tbarbugli

Copy link
Copy Markdown
Member

3RTT task T01, agent side. Builds on #684 (merged in) and on the SDK's join trace (getstream-go-webrtc#7; acceleration/go.mod pins that branch's commit).

What's in it

  • streamedge sets Call.OnJoinTrace and forwards the SDK's jointrace.Report JSON unchanged. It replaces the per-path ConnectionTiming layout from feat: join and WebRTC connection latency DAGs #684.
  • agent.JoinTrace carries that report plus the critical path for logs. Connector.JoinTraces() replaces Connections().
  • The session socket sends a single connection frame {"type": "connection", "trace": <report>}, replayed to watchers that attach late.
  • The Python render_connection draws the DAG from that report, with the parallel branches, a timeline, RTT columns, detail spans under their step, the critical path and the times to media. It prints with log_latency=True / VOICE_LATENCY_DAG=1.

Tests

  • cd acceleration && go test ./... passes. It includes the new streamedge fixtures (the trace is the SDK's report byte for byte, the critical path, reported once) and the session and socket-frame tests.
  • uv run --no-sync pytest plugins/stream/tests -m "not integration" passes (194). test_accelerated.py renders the SDK's report for a real fixture (tests/join_trace.json).
  • ruff check, ruff format and mypy pass on the changed Python.
join DAG (webrtc) RTT coordinator 50.0 ms, RTT sfu 50.0 ms, RTT udp 50.0 ms
  step                   after                                  start       ms    RTT  timeline
* coord.join             -                                        0.0    200.0   4.00  |=============                           |
* pcs.create             coord.join                             200.0      2.0  local  |            =                           |
* sfu.ws.dial            pcs.create                             202.0    150.0   3.00  |            ==========                  |
    .tcp                                                        202.0     50.0   1.00  |            ----                        |
* sfu.join               sfu.ws.dial                            352.0     50.0   1.00  |                      ====              |
  pub.debounce           sfu.join                               402.0      1.0  timer  |                         -              |
* sub.debounce           sfu.join                               402.0     78.0  timer  |                         =====          |
  ...
critical path: coord.join > pcs.create > sfu.ws.dial > sfu.join > sub.debounce > sub.offer > sub.sendanswer > sub.ice > sub.dtls > sub.rtp
  630.0 ms = 11.00 RTT (550.0 ms network) + 78.0 ms timers + 2.0 ms local; 0.0 ms unaccounted waiting

tbarbugli and others added 5 commits September 29, 2026 17:47
The Stream edge now reports, per peer connection, every step from the
start of its join: coordinator websocket and join, SFU websocket and
join, offer/answer (SetPublisher or SendAnswer), ICE start and checks,
DTLS and the first RTP packet. The agent logs it and the session socket
forwards it as a "connection" frame, replaying the latest one to a
watcher that attaches after the path connected.

Pins getstream-go-webrtc to feature/connection-timing (0ab2ab2), which
adds Call.OnConnectionTiming.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With log_latency (VOICE_LATENCY_DAG=1 for simple_voice_ai) the agent
prints its own join as a DAG (create call, components, chat
conversation, router session, event socket) and renders each
"connection" frame from the router as a WebRTC connection DAG. The
agent's steps travel to the pipeline as RemoteCall.join_steps.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…into 3rtt/t01-join-dag

# Conflicts:
#	CHANGELOG.md
#	acceleration/go.mod
#	go.work.sum
The Stream edge takes the Go SDK's join trace (Call.OnJoinTrace) and passes
its JSON report through unchanged, in place of the per-path layout it built
from ConnectionTiming. The session socket's connection frame carries it as
`trace`, and a watcher that attaches late is sent it too.
render_connection draws the SDK's trace: each step with what it waited for,
its time in ms and round trips, a timeline showing the parallel branches,
and the critical path.
@tbarbugli
tbarbugli marked this pull request as ready for review September 30, 2026 15:27
@tbarbugli
tbarbugli merged commit 0c09d29 into factory/3rtt Sep 30, 2026
10 of 12 checks passed
@tbarbugli
tbarbugli deleted the 3rtt/t01-join-dag branch September 30, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant