pub struct Registry { /* private fields */ }Expand description
Counter collection registry. Cheap to clone (Arc inside for the shared
state). One instance per relay; sessions get tier-scoped handles via
Registry::tier. The moq-stats crate drains it with
Registry::report to publish the counters as MoQ broadcasts.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
Build a no-op registry: every handle is empty and all bumps are dropped.
Sourcepub fn exclude(&self) -> &[PathOwned] ⓘ
pub fn exclude(&self) -> &[PathOwned] ⓘ
The excluded path prefixes. See Config::exclude.
Sourcepub fn tier(&self, tier: Tier) -> Handle
pub fn tier(&self, tier: Tier) -> Handle
Returns a tier-scoped handle. Bumps through this handle land in the tier’s counters.
Sourcepub fn snapshot(&self) -> Snapshot
pub fn snapshot(&self) -> Snapshot
Take a host-level Snapshot: every counter summed across all
tracked broadcasts, split by tier and role, plus per-tier session
presence. Briefly takes the entry then the session locks. Returns an
all-zero snapshot for a disabled registry.
Unlike Registry::report, this collapses per-broadcast detail into
node totals (what a /metrics-style scrape wants) and never prunes.
Sourcepub fn report(&self) -> Report
pub fn report(&self) -> Report
Take a per-broadcast Report and prune dead entries.
Returns every (broadcast, tier) traffic readout and every (tier, root) session gauge, then drops the entries no guard references
anymore (their final values are still in the returned report, so a
publisher draining on an interval emits the closing readout exactly
once). A pruned path that sees traffic again restarts from zero; see
the module docs on counter resets. Returns an empty report for a
disabled registry.