#[non_exhaustive]pub struct Stats {Show 15 fields
pub open: u64,
pub accepted: u64,
pub refused: u64,
pub closed: u64,
pub bytes_in: u64,
pub bytes_out: u64,
pub egress_denied: u64,
pub killed: u64,
pub slow_peers: u64,
pub timeouts: u64,
pub descriptor_pressure: u64,
pub stale_completions: u64,
pub session_panics: u64,
pub workers_lost: u64,
pub workers_detached: u64,
/* private fields */
}Expand description
Counters summed over the workers.
let server = net_io::serve("127.0.0.1:0", |_c| Ok(()))?;
let stats = server.stats();
println!("{} open, {} accepted", stats.open, stats.accepted);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.open: u64Connections open now.
accepted: u64Connections accepted.
refused: u64Connections refused.
closed: u64Connections closed.
bytes_in: u64Bytes received.
bytes_out: u64Bytes sent.
egress_denied: u64Writes the gate denied.
killed: u64Connections killed.
slow_peers: u64Connections closed for the minimum rate.
timeouts: u64Connections closed by a timeout.
descriptor_pressure: u64Times the process ran out of descriptors.
stale_completions: u64Completions for connections that had closed.
session_panics: u64Sessions that panicked.
workers_lost: u64Reactor workers whose loop ended on a panic or a failed wait. Such a worker takes no more connections (the others take them, and its own listening sockets, instead); its connections were closed when it ended.
workers_detached: u64Worker threads a stop left running: their connection was killed at the drain’s deadline, but its owner did not return within the grace after it (a blocking handler that never touches its socket). Each ends on its own.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn refused_for(&self, cause: RefusalCause) -> u64
pub fn refused_for(&self, cause: RefusalCause) -> u64
Refusals with this cause (gate codes summed).
Sourcepub fn closed_for(&self, reason: CloseReason) -> u64
pub fn closed_for(&self, reason: CloseReason) -> u64
Closes with this reason’s variant (inner values ignored).
Sourcepub fn closes(&self) -> impl Iterator<Item = (CloseReason, u64)> + '_
pub fn closes(&self) -> impl Iterator<Item = (CloseReason, u64)> + '_
Every close reason with a non-zero count, one entry per variant (inner
values are not kept: Killed carries reason 0, Io class Other(0)).
let server = net_io::serve("127.0.0.1:0", |_c| Ok(()))?;
for (reason, n) in server.stats().closes() {
println!("{}: {n}", reason.as_str());
}Sourcepub fn refusals(&self) -> impl Iterator<Item = (RefusalCause, u64)> + '_
pub fn refusals(&self) -> impl Iterator<Item = (RefusalCause, u64)> + '_
Every refusal cause with a non-zero count (gate codes summed under Gate(0)).