pub struct StatsRecorder { /* private fields */ }Expand description
Cheap-to-clone handle over global + per-room atomic counters.
All recording methods are lock-free (AtomicU64 / sharded DashMap)
and safe to call from any thread. Clone handles share state.
Implementations§
Source§impl StatsRecorder
impl StatsRecorder
Sourcepub fn inc_connections(&self) -> u64
pub fn inc_connections(&self) -> u64
Record a connection accepted. Returns the new count.
Sourcepub fn dec_connections(&self) -> u64
pub fn dec_connections(&self) -> u64
Record a connection closed (saturating at zero). Returns the new count.
Sourcepub fn room_opened(&self)
pub fn room_opened(&self)
Record a room coming into existence (manager created it).
Sourcepub fn room_closed(&self)
pub fn room_closed(&self)
Record a room removed (saturating at zero).
Sourcepub fn record_message_in(&self, bytes: u64)
pub fn record_message_in(&self, bytes: u64)
Record an inbound message of bytes payload bytes (global only —
use StatsRecorder::record_room_message_in to also attribute it
to a room).
Sourcepub fn record_message_out(&self, count: u64, bytes: u64)
pub fn record_message_out(&self, count: u64, bytes: u64)
Record count outbound messages totalling bytes payload bytes
(global only).
Sourcepub fn record_drop(&self)
pub fn record_drop(&self)
Record a drop: a broadcast that found no live receiver.
Sourcepub fn record_room_message_in(&self, room: &str, bytes: u64)
pub fn record_room_message_in(&self, room: &str, bytes: u64)
Record an inbound message attributed to room (also bumps globals).
Sourcepub fn record_room_message_out(&self, room: &str, count: u64, bytes: u64)
pub fn record_room_message_out(&self, room: &str, count: u64, bytes: u64)
Record a room broadcast reaching count receivers with bytes
total payload bytes (also bumps globals).
Sourcepub fn record_room_drop(&self, room: &str)
pub fn record_room_drop(&self, room: &str)
Record a drop attributed to room (also bumps the global count).
Trait Implementations§
Source§impl Clone for StatsRecorder
impl Clone for StatsRecorder
Source§fn clone(&self) -> StatsRecorder
fn clone(&self) -> StatsRecorder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more