Repository navigation
feat(stats): collect owned transport wire counters #5773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e3f456f
77ea29f
a6cd2a8
717ca64
83bb351
1cb3e3e
71f77c9
b825a2c
d951265
b3eeb21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,6 +289,7 @@ impl Session { | |
|
|
||
| /// The handles a protocol driver shares with its [`Session`]. | ||
| pub(super) struct Handles { | ||
| pub stats: crate::stats::Session, | ||
| pub goaway: goaway::Handle, | ||
| pub auth: auth::Handle, | ||
| /// Where the driver publishes [`Estimate`] changes, for a protocol that reports | ||
|
|
@@ -308,7 +309,13 @@ impl Session { | |
| where | ||
| S: crate::transport::poll::Session, | ||
| { | ||
| let Handles { goaway, auth, estimate } = handles; | ||
| let Handles { | ||
| goaway, | ||
| auth, | ||
| estimate, | ||
| stats: context, | ||
| } = handles; | ||
| let wire = session.wire().map(|counters| context.wire(counters)); | ||
| let sample = snapshot(&session); | ||
| if let Some(estimate) = &estimate | ||
| && let Ok(mut current) = estimate.write() | ||
|
|
@@ -341,6 +348,7 @@ impl Session { | |
| close: Some(close.consume()), | ||
| closed, | ||
| stats: stats.clone(), | ||
| wire, | ||
| send_bandwidth: send_producer, | ||
| estimate, | ||
| sampled: None, | ||
|
|
@@ -401,6 +409,8 @@ pub(crate) struct Supervisor<S> { | |
| sampled: Option<crate::time::Instant>, | ||
| mode: SamplerMode, | ||
| drain: Drain, | ||
| /// The transport's wire counters, registered under the session's root; dropping records the last reading. | ||
| wire: Option<crate::stats::Wire>, | ||
| } | ||
|
|
||
| /// A [`Session::close`] waiting for the protocol to deliver what it queued. | ||
|
|
@@ -436,6 +446,7 @@ impl<S: crate::transport::poll::Session> Supervisor<S> { | |
| // this cell, so leave it holding the session's final counters | ||
| // rather than whichever sample the last demand happened to catch. | ||
| self.stats.lock().sample = snapshot(&self.session); | ||
| self.wire.take(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
# Check when the error is set relative to the CONNECTION_CLOSE transmit, and whether the driver keeps updating the counters afterward.
rg -nP -C4 'fn (close|terminate|implicit_close)\b' rs/moq-tokio/src/quic/driver/connection.rs
rg -nP -C3 'is_drained|set_sent_bytes|set_received_bytes' rs/moq-tokio/src/quic/driver/connection.rs rs/moq-uring/src/quic/driverRepository: moq-dev/moq Length of output: 5664 🏁 Script executed: #!/bin/bash
set -o pipefail
printf '%s\n' '--- session.rs relevant symbols ---'
rg -n -C8 -F -- 'self.wire.take()' rs/moq-net/src/session.rs
rg -n -C10 -F -- 'poll_closed' rs/moq-net/src/session.rs
rg -n -F -- 'struct Supervisor' rs/moq-net/src/session.rs rs/moq-net/src
rg -n -F -- 'struct Driver' rs/moq-tokio/src/quic/driver rs/moq-uring/src/quic/driver
printf '%s\n' '--- tokio driver poll block ---'
sed -n '240,335p' rs/moq-tokio/src/quic/driver/connection.rs
sed -n '1320,1360p' rs/moq-tokio/src/quic/driver/connection.rs
printf '%s\n' '--- io_uring driver close/poll blocks ---'
sed -n '740,805p' rs/moq-uring/src/quic/driver/connection.rs
sed -n '875,930p' rs/moq-uring/src/quic/driver/connection.rsRepository: moq-dev/moq Length of output: 12412 🏁 Script executed: #!/bin/bash
set -o pipefail
printf '%s\n' '--- session close path ---'
rg -n -C12 -F -- 'self.wire.take()' rs/moq-net/src/session.rs
rg -n -C15 -F -- 'poll_closed' rs/moq-net/src/session.rs
printf '%s\n' '--- stats wire definitions and uses ---'
rg -n -C12 -F -- 'struct Wire' rs/moq-net/src
rg -n -C10 -F -- 'Wire::drop' rs/moq-net/src rs
printf '%s\n' '--- tokio full poll function candidates ---'
rg -n -C5 -F -- 'fn poll' rs/moq-tokio/src/quic/driver/connection.rs
printf '%s\n' '--- io_uring close publication and driver poll ---'
rg -n -C15 -F -- 'publish_close' rs/moq-uring/src/quic/driver/connection.rs
rg -n -C12 -F -- 'set_sent_bytes' rs/moq-uring/src/quic/driver/connection.rsRepository: moq-dev/moq Length of output: 23504 Keep the wire guard alive until the transport driver finishes draining.
The final sample can therefore miss late closing traffic. Keep the guard until driver completion, or take the final sample after the driver drains. 🤖 Prompt for AI Agents |
||
| let drain = match std::mem::replace(&mut self.drain, Drain::Idle) { | ||
| Drain::Done(res) => Some(res), | ||
| _ => None, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Move the embedder API steps to rustdoc and remove the plan wording.
transport::Wire, register it withstats::Handle::wireorstats::Session::wire, and hold the guard. This belongs on those items' rustdoc. Here, link to it instead.quest/m2/wire-stats/qmux.md.📝 Proposed doc edit
As per coding guidelines: "Leave method and field lists, wire encodings, error codes, and per-version accounting to the API docs and drafts. Link to them." and "Describe only what ships. Plans live in quests."
🤖 Prompt for AI Agents
Source: Coding guidelines