Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions quinn-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ tracing-log = ["tracing/log"]
rustls-log = ["rustls?/logging"]
# Enable qlog support
qlog = ["dep:qlog"]
# Add serde support.
serde = ["dep:serde"]

# Internal (PRIVATE!) features used to aid testing.
# Don't rely on these whatsoever. They may disappear at any time.
Expand All @@ -57,6 +59,7 @@ slab = { workspace = true }
thiserror = { workspace = true }
tinyvec = { workspace = true, features = ["alloc"] }
tracing = { workspace = true }
serde = { workspace = true, optional = true }

# Feature flags & dependencies for wasm
# wasm-bindgen is assumed for a wasm*-*-unknown target
Expand Down
6 changes: 6 additions & 0 deletions quinn-proto/src/connection/stats.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//! Connection statistics

use crate::{Dir, Duration, frame::Frame};
#[cfg(feature = "serde")]
use serde::Serialize;

/// Statistics about UDP datagrams transmitted or received on a connection
///
/// All QUIC packets are carried by UDP datagrams. Hence, these statistics cover all traffic on a connection.
#[derive(Default, Debug, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
#[non_exhaustive]
pub struct UdpStats {
/// The amount of UDP datagrams observed
Expand All @@ -28,6 +31,7 @@ impl UdpStats {

/// Number of frames transmitted or received of each frame type
#[derive(Default, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
#[non_exhaustive]
#[allow(missing_docs)]
pub struct FrameStats {
Expand Down Expand Up @@ -132,6 +136,7 @@ impl std::fmt::Debug for FrameStats {

/// Statistics related to a transmission path
#[derive(Debug, Default, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
#[non_exhaustive]
pub struct PathStats {
/// Current best estimate of this connection's latency (round-trip-time)
Expand Down Expand Up @@ -159,6 +164,7 @@ pub struct PathStats {

/// Connection statistics
#[derive(Debug, Default, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
#[non_exhaustive]
pub struct ConnectionStats {
/// Statistics about UDP datagrams transmitted on a connection
Expand Down
3 changes: 3 additions & 0 deletions quinn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ tracing-log = ["tracing/log", "proto/tracing-log", "udp/tracing-log"]
rustls-log = ["rustls?/logging"]
# Enable qlog support
qlog = ["proto/qlog"]
# Add serde support.
serde = ["dep:serde"]

# Internal (PRIVATE!) features used to aid testing.
# Don't rely on these whatsoever. They may disappear at any time.
Expand All @@ -64,6 +66,7 @@ thiserror = { workspace = true }
tracing = { workspace = true }
tokio = { workspace = true }
udp = { package = "quinn-udp", path = "../quinn-udp", version = "0.6", default-features = false, features = ["tracing"] }
serde = { workspace = true, optional = true }

[target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies]
socket2 = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions quinn/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use proto::{
EndpointEvent, ServerConfig,
};
use rustc_hash::FxHashMap;
#[cfg(feature = "serde")]
use serde::Serialize;
#[cfg(all(not(wasm_browser), any(feature = "aws-lc-rs", feature = "ring"),))]
use socket2::{Domain, Protocol, Socket, Type};
use tokio::sync::{Notify, futures::Notified, mpsc};
Expand Down Expand Up @@ -334,6 +336,7 @@ impl Endpoint {
/// Statistics on [Endpoint] activity
#[non_exhaustive]
#[derive(Debug, Default, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct EndpointStats {
/// Cummulative number of Quic handshakes accepted by this [Endpoint]
pub accepted_handshakes: u64,
Expand Down