Publish and consume MoQ traffic stats.
moq-net collects per-session traffic counters in a
stats::Registry; this crate turns that
registry into MoQ broadcasts and back:
- [
Producer] drains a registry on an interval and publishes the counters as JSON tracks on an origin. - [
Consumer] subscribes to one published stats broadcast and yields typed frames, for aggregators, dashboards, and billing meters. - [
aggregate::Consumer] folds a whole group's per-node broadcasts into one merged view, so a downstream sees a project's total live traffic as if it came from a single node.
Wire format
A [Producer] publishes one broadcast per node at <prefix>/node/<node>
(default prefix .stats), or one per group of leading broadcast-path
segments at <prefix>/<group>/node/<node>; parse announce paths back with
[parse_node_path]. Each [Tier] carries publisher.json,
subscriber.json, and sessions.json tracks of cumulative [Traffic] and
[Presence] counters, plus .json.z siblings encoded with
[moq_json::snapshot]; compute names with [traffic_track] /
[sessions_track]. The full contract (paths, tracks, both encodings, and
counter semantics) is at https://doc.moq.dev/concept/stats.