Skip to content
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

Add additional metrics for lost packets and bytes #1248

Merged
merged 1 commit into from Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion quinn-proto/src/connection/mod.rs
Expand Up @@ -1370,7 +1370,13 @@ impl Connection {
let old_bytes_in_flight = self.in_flight.bytes;
let largest_lost_sent = self.spaces[pn_space].sent_packets[&largest_lost].time_sent;
self.lost_packets += lost_packets.len() as u64;
trace!("packets lost: {:?}", lost_packets);
self.stats.path.lost_packets += lost_packets.len() as u64;
self.stats.path.lost_bytes += size_of_lost_packets as u64;
trace!(
"packets lost: {:?}, bytes lost: {}",
lost_packets,
size_of_lost_packets
);
for packet in &lost_packets {
let info = self.spaces[pn_space].sent_packets.remove(packet).unwrap(); // safe: lost_packets is populated just above
self.remove_in_flight(pn_space, &info);
Expand Down
1 change: 1 addition & 0 deletions quinn-proto/src/connection/packet_builder.rs
Expand Up @@ -188,6 +188,7 @@ impl PacketBuilder {

conn.in_flight.insert(&packet);
conn.spaces[space_id].sent(exact_number, packet);
conn.stats.path.sent_packets += 1;
conn.reset_keep_alive(now);
if size != 0 {
if ack_eliciting {
Expand Down
6 changes: 6 additions & 0 deletions quinn-proto/src/connection/stats.rs
Expand Up @@ -126,6 +126,12 @@ pub struct PathStats {
pub cwnd: u64,
/// Congestion events on the connection
pub congestion_events: u64,
/// The amount of packets lost on this path
pub lost_packets: u64,
/// The amount of bytes lost on this path
pub lost_bytes: u64,
/// The amount of packets sent on this path
pub sent_packets: u64,
}

/// Connection statistics
Expand Down