pub struct Consumer { /* private fields */ }Expand description
Folds a group’s per-node stats broadcasts into one merged view.
Scope an origin::Consumer to a single group (e.g. .stats/<pid>) and
hand it here; each Self::traffic / Self::sessions call opens its own
announce cursor and subscribes to that track on every node broadcast in the
group, summing the cumulative counters per key. A node dropping out (its
broadcast unannounces) removes its contribution, so the merged counter
regresses: downstream treats that decrease as a fresh segment, the same
reset contract a single node’s own restart follows.
Implementations§
Source§impl Consumer
impl Consumer
Sourcepub fn new(origin: Consumer, config: Config) -> Self
pub fn new(origin: Consumer, config: Config) -> Self
Wrap an origin consumer, ideally already scoped to one group. config’s
prefix and depth must match the producing side.
Sourcepub fn traffic(&self, tier: &Tier, role: Role) -> TrafficConsumer
pub fn traffic(&self, tier: &Tier, role: Role) -> TrafficConsumer
A merged reader over the traffic track for (tier, role), folding every
node broadcast in the group. Nodes are subscribed lazily as they announce,
so this returns without a handshake.
Sourcepub fn sessions(&self, tier: &Tier) -> SessionsConsumer
pub fn sessions(&self, tier: &Tier) -> SessionsConsumer
A merged reader over the sessions track for tier; see Self::traffic.