pub struct Stats { /* private fields */ }Expand description
Top-level stats aggregator. Cheap to clone (Arc inside for the shared
runtime state). One instance per relay; sessions get tier-scoped handles via
Stats::tier. Build it from a StatsConfig via Stats::new.
Implementations§
Source§impl Stats
impl Stats
Sourcepub fn new(config: StatsConfig) -> Self
pub fn new(config: StatsConfig) -> Self
Build a stats aggregator from config.
When config has an origin, this spawns the snapshot task immediately
and publishes the stats broadcast; the task runs until the last Stats
clone is dropped. With no origin the aggregator is a no-op (bumps are
dropped, nothing is published) and no task spawns, so it’s safe to build
outside an async runtime.
Sourcepub fn tier(&self, tier: Tier) -> StatsHandle
pub fn tier(&self, tier: Tier) -> StatsHandle
Returns a tier-scoped handle. Bumps through this handle land in the tier’s counters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stats
impl RefUnwindSafe for Stats
impl Send for Stats
impl Sync for Stats
impl Unpin for Stats
impl UnsafeUnpin for Stats
impl UnwindSafe for Stats
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