pub struct ServerStats { /* private fields */ }Expand description
Thread-safe server statistics collector.
Implementations§
Source§impl ServerStats
impl ServerStats
Sourcepub fn new() -> ServerStats
pub fn new() -> ServerStats
Create a new metrics collector with zeroed counters.
Sourcepub fn record_request(&self, method: &str, latency: Duration, success: bool)
pub fn record_request(&self, method: &str, latency: Duration, success: bool)
Record a completed request.
Sourcepub fn record_cancelled(&self, method: &str, latency: Duration)
pub fn record_cancelled(&self, method: &str, latency: Duration)
Record a cancelled request.
Sourcepub fn connection_opened(&self)
pub fn connection_opened(&self)
Record a new client connection.
Sourcepub fn connection_closed(&self)
pub fn connection_closed(&self)
Record a closed client connection.
Sourcepub fn add_bytes_received(&self, bytes: u64)
pub fn add_bytes_received(&self, bytes: u64)
Add to the received byte counter.
Sourcepub fn add_bytes_sent(&self, bytes: u64)
pub fn add_bytes_sent(&self, bytes: u64)
Add to the sent byte counter.
Sourcepub fn snapshot(&self) -> StatsSnapshot
pub fn snapshot(&self) -> StatsSnapshot
Get a point-in-time snapshot of all counters.
Trait Implementations§
Source§impl Clone for ServerStats
impl Clone for ServerStats
Source§fn clone(&self) -> ServerStats
fn clone(&self) -> ServerStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerStats
impl Debug for ServerStats
Source§impl Default for ServerStats
impl Default for ServerStats
Source§fn default() -> ServerStats
fn default() -> ServerStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ServerStats
impl RefUnwindSafe for ServerStats
impl Send for ServerStats
impl Sync for ServerStats
impl Unpin for ServerStats
impl UnwindSafe for ServerStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).