#[non_exhaustive]pub struct Traffic {Show 13 fields
pub announces_started: u64,
pub announces_ended: u64,
pub announced_bytes: u64,
pub broadcasts_started: u64,
pub broadcasts_ended: u64,
pub subscriptions_started: u64,
pub subscriptions_ended: u64,
pub fetches: u64,
pub bytes: u64,
pub frames: u64,
pub groups: u64,
pub datagrams: u64,
pub stale: Content,
}Expand description
Counter collection, re-exported from moq_net::stats so stats consumers
can depend on this crate alone.
A cumulative traffic counter readout for one slice (a broadcast on a
(tier, role), or any sum of such slices).
Every counter is cumulative, so a rate is delta / delta_t and a live
count is started - ended. This is also the wire shape of one entry on a
published stats track (the moq-stats crate serializes maps of these).
Serialize writes both the canonical *_started/*_ended names and the
legacy announced/*_closed spellings so an older consumer still reads a
new relay; deserialize accepts either spelling, with the canonical name
winning when both are present. Unknown fields from a newer publisher are
ignored and missing fields from an older one default to zero.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.announces_started: u64Cumulative broadcast announce events on this slice.
announces_ended: u64Cumulative broadcast unannounce events on this slice.
announced_bytes: u64Cumulative announce-control bytes: the broadcast name length summed
over each announce and unannounce. Distinct from bytes (payload).
broadcasts_started: u64Per-(broadcast, session) subscription sentinel opens: the first active subscription a session holds on a broadcast.
broadcasts_ended: u64Sentinel closes: the session’s last subscription to the broadcast ended.
subscriptions_started: u64Cumulative track-level subscriptions opened.
subscriptions_ended: u64Cumulative track-level subscriptions closed.
fetches: u64Cumulative one-shot group fetches requested. Counted once per coalesced fetch
when the fetch is issued, so one that resolves to NotFound still counts.
Separate from subscriptions_started and the viewer refcount. Fetched payload still
flows into bytes/frames/groups.
bytes: u64Cumulative payload bytes.
frames: u64Cumulative frames delivered.
groups: u64Cumulative groups delivered.
datagrams: u64Cumulative single-frame groups delivered over an unreliable QUIC datagram.
A subset of groups: each one also counts there and its payload in
frames / bytes.
stale: ContentContent skipped because it aged past a subscriber’s
max_age budget. Disjoint from the top-level payload
counters: skipped content is never handed over. A steady rate here means
subscribers are consistently behind the live edge.
Implementations§
Source§impl Traffic
impl Traffic
Sourcepub fn is_announced(&self) -> bool
pub fn is_announced(&self) -> bool
True while the broadcast is announced (an announce guard is open).
Sourcepub fn active_broadcasts(&self) -> u64
pub fn active_broadcasts(&self) -> u64
Distinct sessions currently subscribed (viewers on the egress side).
Sourcepub fn active_subscriptions(&self) -> u64
pub fn active_subscriptions(&self) -> u64
Track subscriptions currently open.
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
All bytes attributable to this slice: payload plus announce overhead. Both inputs are monotonic, so the sum regresses only when the entry was garbage collected and re-created.