Repository navigation
feat(relay): the session log says what each session is; class apart from transport - #514
Merged
Merged
Conversation
"relay: new session" carried the remote address and whether the session was checked. It now names the session id, the transport, the path, the credential's sub, the MoQ version, the ALPN, the TLS version and the SNI, and for an upgraded session the subprotocols the client offered, its user agent and its origin. "relay: session ended" is new: the reason, the duration and the byte totals. A WebTransport client that offers no subprotocol is served as before; its line now shows an empty offer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
The transport label of the session metrics said "peer" or "internal" for a relay peer's or an internal client's session. Those are not transports: both run over native QUIC. The metrics and the session log now name the class (client, internal, peer) and the transport (webtransport, websocket, quic) separately. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G
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.
Why
relay: new sessionsaid only where a session came from and whether it was checked:That is not enough to tell what a client is or what it speaks. Found while looking at foalk-inc/foalk#536: a WebTransport client that offers no subprotocol (an older browser, or a client library that passes none) is served like any other, and nothing in the log distinguishes it from one that agreed on
moq-lite-05. Nothing logged a session's end either, apart from a warning from the announcements loop.The session metrics had a related problem: their
transportlabel saidpeerorinternalfor some sessions, which are not transports.Change
The log
relay: new sessionnow carries:idsession ended by its grant; absent for a peer or an internal client, which have no connect requestclassclient,internalorpeer: whom the relay takes the session for (below)transportwebtransport,websocketorquicpathsubsub, when it has onemoqalpn,tls,sniofferedWT-Available-Protocols, orSec-WebSocket-Protocol), as sent. Empty for a client that offered noneuser_agent,originrelay: session endedis new:id,class,transport,remote, thereason(the one in the usage record and thesessions_closedmetric), thedurationandbytes_sent/bytes_received.Header values come from the client, so they are logged without control characters and cut at 256 bytes.
Nothing about admission changes. A client that offers no subprotocol is still served.
Class and transport, in the metrics too (breaking for dashboards)
The relay already sorts sessions into three classes (
sessionClass,peer_trust.go), because each is asked for something different and allowed something different:clientinternalpeerFor an operator the class answers a different question from the transport:
peerbytes are traffic between relays, not what customers sent, and the number ofpeersessions is the state of the mesh, not load.qumo_relay_sessions_total,qumo_relay_sessions_closed_totalandqumo_relay_session_bytes_totalfolded the class intotransport, which saidpeerorinternalfor those sessions. They now have aclasslabel, andtransportis only a transport; peers and internal clients aretransport="quic".transport="quic"used to select native-QUIC clients alone. Addclass="client"to keep that.transport="peer"andtransport="internal"becomeclass="peer"andclass="internal".No dashboard or alert in qumo, qumo-deploy or foalk queries these three metrics.
What
moqis, and is notmoqis gomoqt'sConnectionState.Version, which is the version the library speaks, a constant. It is not read from the negotiation. What the client asked for is inalpn(native QUIC) andoffered(upgrades); gomoqt refuses an upgrade whose offer has nothing the relay supports, so a non-emptyofferedon a served session means the two agreed. gomoqt does not expose the selected subprotocol on aSession; if it did, this line could carry it directly.Output
From the tests:
Checked
go test ./internal/relay/andgo test -tags=integration ./internal/integration/pass;go vetandgolangci-lint run ./internal/relay/are clean.Note for operators
The log now holds
sub,user_agentandoriginper session, next to the remote address it already held.🤖 Generated with Claude Code
https://claude.ai/code/session_01PskJnUHF5bxqi5ksWgz63G