proto: promote recovery metrics to PathStats#2581
Open
JavaPerformance wants to merge 1 commit into
Open
Conversation
Add bytes_in_flight, packets_in_flight, min_rtt, latest_rtt, rtt_variance, and pto_count to PathStats. These values are already computed internally for qlog recovery metrics, but accessing them through qlog requires per-event Arc<Mutex> locking and JSON serialization — unsuitable for high-frequency polling in relay/proxy workloads. Promoting them to PathStats makes them available through the existing zero-overhead Connection::stats() path. Also adds public latest() and var() getters on RttEstimator (min() already existed).
djc
approved these changes
Mar 23, 2026
djc
left a comment
Member
There was a problem hiding this comment.
Mostly looks okay, modulo one nit.
| } | ||
|
|
||
| /// Current RTT variance estimate, computed as described in RFC 6298 | ||
| pub fn var(&self) -> Duration { |
Member
There was a problem hiding this comment.
I don't think var is a good name for public API...
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.
Summary
Promote 6 fields from qlog-only
RecoveryMetricstoPathStats, making them available through the zero-overheadConnection::stats()path:bytes_in_flight: u64— bytes in-flight per congestion controlpackets_in_flight: u64— ack-eliciting packets in flightmin_rtt: Duration— minimum observed RTT (ignoring ack delay)latest_rtt: Duration— most recent RTT samplertt_variance: Duration— smoothed RTT variance (RFC 6298)pto_count: u32— probe timeout event countAlso adds
latest()andvar()public getters onRttEstimator(min()already existed).Motivation
These values are already computed internally and surfaced through qlog's
MetricsUpdatedevent. However, accessing them via qlog requires enabling theqlogfeature and paying per-eventArc<Mutex>locking + JSON serialization overhead — unsuitable for high-frequency polling in relay/proxy workloads that need to make adaptive decisions (e.g., flow control window sizing based on BDP).Promoting them to
PathStatsmakes them available with zero additional overhead sincestats()already snapshotsrtt,cwnd, andcurrent_mtufrom the same internal state.Use cases
min_rtt(not smoothed RTT) is the correct input for bandwidth-delay product estimation.bytes_in_flightvscwndinstantly distinguishes flow-control-limited from congestion-limited connections.latest_rtt+rtt_varianceenable jitter detection without qlog.pto_countidentifies connections experiencing repeated probe timeouts.Changes
quinn-proto/src/connection/stats.rs— 6 new fields onPathStatsquinn-proto/src/connection/paths.rs— 2 new pub getters onRttEstimatorquinn-proto/src/connection/mod.rs— populate new fields instats()All fields use
#[non_exhaustive](inherited fromPathStats), so this is backwards-compatible.Related
bytes_in_flighthelps here)