Repository navigation
feat(stats): linger an empty group broadcast before unannouncing it - #4871
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A grouped stats broadcast (`<prefix>/<group>/node/<node>`) now stays
announced for `Config::linger` (default 5 minutes) after its group's last
traffic and session entries leave, so viewer churn no longer unannounces and
re-announces it across the mesh. While it lingers empty its tracks read `{}`;
a returning entry re-arms the linger. The relay exposes it as
`stats.linger` / `--stats-linger` / `MOQ_STATS_LINGER`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outcome (quest start, unattended):
(Written by Claude Opus 5.5) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: c8a4060
No actionable correctness findings in the full diff and surrounding producer/configuration code.
Direction looks sound: monotonic, per-group idle timing resets when either traffic or sessions return, preserves depth-0 lifetime, and keeps zero-linger behavior (rs/moq-stats/src/produce.rs:359–381, 851–860). Lingering groups still flush empty frames and prune per-path state, so a returning path follows the existing reset semantics; the plain/compressed tracks share that path. The relay knob follows the existing duration adapter and precedence pattern (rs/moq-relay/src/stats.rs:81–114, 127–141).
Verification limits: static review only; I did not run the added paused-time tests or configuration tests. The author's local check result is reported, not independently reproduced; the latest fetched Check and Platform runs were queued. The release backport remains separate.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (9)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. WalkthroughThe stats producer now keeps empty grouped broadcasts announced for a configurable linger period, which defaults to five minutes. Returning entries reuse the broadcast if they return before expiry. Relay configuration supports TOML, environment, and CLI values, with the CLI value taking precedence. Tests cover linger expiry, returning entries, zero linger, and configuration overrides. Documentation and quest notes describe the behavior and backport status. Priority: ⬆️ High Merge Risk: ⚪ Minimal · up to The linger behavior is ready to merge after normal checks; no actionable risk remains identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Authorization and cleanup ownership remain intact. The main risk is increased resource retention when grouped stats are enabled and a permitted client can generate many distinct groups. Stats remain disabled by default, depth zero is unaffected, and setting linger to zero restores immediate empty-group removal. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 73.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 4 files. (5 skipped: 5 unsupported.)
✨ Finishing Touches✨ Simplify code
🧰 Additional context used📚 Code guidelines (3)Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merge summary:
(Written by Claude Opus 5.5) |
feat(stats): linger an empty group broadcast before unannouncing it (backport #4871)
…backport moq-dev#4871) A grouped stats broadcast (`<prefix>/<group>/node/<node>`) now stays announced for `Config::linger` (default 5 minutes) after its group's last traffic and session entries leave, so viewer churn no longer unannounces and re-announces it across the mesh. While it lingers empty its tracks read `{}`; a returning entry re-arms the linger. The relay exposes it as `stats.linger` / `--stats-linger` / `MOQ_STATS_LINGER`. Cherry-pick of moq-dev#4871 (a52ee7e) onto `release`; the announce test helper uses `release`'s announce update API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
At
depth>= 1 a group's stats broadcast (<prefix>/<group>/node/<node>) is unannounced on the first drain its group has no traffic or session entries, and re-announced when one returns. On moq.pro's fleet (2026-09-29) one customer's node stats broadcasts ended on 31 nodes at once every 2 to 4 minutes and returned 46 to 112 s later, churning announces across the mesh.Quest:
quest/m0/stats-linger.md.Approach
moq_stats::produce::Config::linger(default 5 minutes,with_linger): a group broadcast stays announced until it has been empty for the linger. A returning entry re-arms it. Zero keeps today's behavior (unannounce on the first empty drain). Depth 0 is unchanged.{}: no live gauges, no session presence.mainstill has the per-path maps (docs(quest): stats totals and per-broadcast tracks replace the per-path maps #4846 only planned the stats split), so a path that leaves drops out of frames as it does today, and its return reads as a restart from zero. A reader diffing frames counts the same totals as it would across an unannounce and re-announce. The producer-wide group allocator already keeps group numbers increasing across the return.stats.linger/--stats-linger/MOQ_STATS_LINGER(humantime, e.g.5m), using the same skip-plus-_argpattern ascache.duration. Unset keeps the producer default.Impact
moq-stats: new public fieldproduce::Config::lingerandConfig::with_linger.Configis#[non_exhaustive], so this is additive. Behavior change: at depth >= 1, an empty group broadcast now stays announced for 5 minutes by default instead of unannouncing at once.moq-relay: newstats::Config::linger: Option<Duration>and thestats.linger/--stats-linger/MOQ_STATS_LINGERsetting.doc/concept/stats.md,doc/bin/relay/config.md.Decisions
Confirmed by the maintainer (2026-10-05):
releasebackport drops the path from frames while its group lingers empty, matchingmain, rather than carrying its last totals forward.Alternatives
main: the stats split replaces the per-path maps with per-group totals that continue under one epoch, and dropping the path matches today's semantics for a path that leaves a live group.Follow-ups
releasebackport (moq.pro tracksrelease).release'sproduce.rsdiffers frommain's only by the wall-clock group seed (fix(stats): resume past cached groups after reclaim or restart (backport) #4810), so this should cherry-pick cleanly with the same drop-from-frames semantics. The quest file stays onmain, trimmed to that backport.quest/m0/broadcast-epoch/stats-split.mdupdated).🤖 Generated with Claude Code
(Written by Claude Opus 5.5)