feat(r76): broadcaster memory telemetry, a telemetry audit and PoP telemetry (R77) #563
Bug: once a mint request goes unanswered, its pool stops asking for tokens.
p.asked is set here after a TelemetryMint is sent successfully. Only a TelemetryTokens or TelemetryRefused reply for this pool clears it again. There is no timeout, the 500 ms retry timer only re-runs this loop, and the pools live on c.tel, which outlives relinks.
Home doesn't always answer:
mint then finds local(pop) == nil and returns without replying, or its SendToLink fails.mint also returns silently when the hex decode or MintTelemetrySessionTokenForIssuer fails.tokens() returns early on a malformed BroadcastKey, before it clears asked.In any of these cases the pool keeps asked = true and never sends another request. Once its remaining tokens are used up, every new session on that broadcast and role waits the full popTelemetryWait and sends no telemetry hello. The idle sweep never removes the pool either, because take() refreshes p.used on every call. A busy broadcast loses PoP telemetry for as long as sessions keep arriving.
Suggested fix: store an askedAt time and treat asked as expired after a few telemetryRetry intervals, or reset asked on every pool when the link comes back up. Also have home's silent error paths send a TelemetryRefused reply.
Confirmed and fixed in 87cb38ad, test first: both new tests failed on the old code (one mint request in 3 s; a malformed answer left the request outstanding).
telemetryAskExpiry (4 × telemetryRetry, 2 s), and the next draw asks again. That covers a request written just before the link dropped, including a 4002 drain or a rolling update. In that case the old pod's local(pop) == nil path has nothing to answer on, which is now commented.tokens() settles the request on any answer, malformed included, before it validates the contents.TelemetryRefused{reason: "error"}.Tests: popclient TestAnUnansweredMintIsAskedAgain, TestAMalformedAnswerSettlesTheRequest. The PoP fleet tests still pass. docs/78 D5 records the expiry.
Code review
No issues found. Checked for bugs and CLAUDE.md compliance.
claude[bot]
tuhokuutio[bot]
What and why
Started from a report: the Windows broadcaster went from about 250 MB to almost 750 MB after switching Delivery to Reliable mid-stream, and telemetry could show neither the step nor the baseline. Three milestones followed.
R76 — broadcaster memory, measured ([docs/77](docs/77-broadcaster-memory.md))
memory-over-budgetandmemory-growthwarn (neverbad).memoryevent outlives it.Telemetry audit (docs/77 D12–D16)
sentFrames,keyframeIntervalMs, the carrier counters, … were never rolled up). Parity is typed for broadcasters.delivery-changed,uplink-warning,uplink-loss,network.leg-a-broadcaster-uplink. The publisher is now markedpublisherKind: "pop-leg", its loss has its ownpop_leg_ingress_*family, andpop-uplink-legnames the venue's line.R77 — PoP telemetry ([docs/78](docs/78-pop-telemetry.md))
gawk-relayrefuses-telemetry-key./internal/telemetry/pops, not/statusz, which is also public).Commits are split per component for release-please:
gawk-broadcast-desktop,gawk-ios(shared engine),gawk-server,gawk-telemetry,gawk-app, docs.Verification
gawk-server:go vet ./...,go test ./...green. New:wireissuer tests (golden token unchanged),hubTestAPopLegsIngressIsItsOwnLeg,metricsTestLossAttributionByLeg, fleet testsTestPopSessionsGetHomeMintedTelemetry,TestHomeMintsOnlyWithinScopeAndRate,TestAPopOfAHomeWithoutTelemetrySendsNoHello,configrelay refusal. Thepop-legassertion was checked to fail without the change.gawk-telemetry:go vet ./...,go test ./...green; stored-shape golden extended (additive only).TestSessionsJoinOnlyTheRelayThatServedThemfails without the issuer filter.gawk-app:vitest run1838 passed;oxlint,tsc -bclean.gawk-broadcast-desktop:cargo test --workspace,cargo clippy --workspace --all-targets -D warnings,cargo fmt --checkon Linux;cargo xwin clippy --workspace --target x86_64-pc-windows-msvc -D warnings.gawk-admin,gawk-sampler: build and vet against the changedgawk-server.rustc --target aarch64-apple-ios) — themacosandios.ymljobs are the first compile. No hardware pass: the numbers against Task Manager / Activity Monitor (docs/77 MM5) and a real party end to end (docs/78) are open.Checklist
git commit -s)ROADMAP.md,docs/gotchas.mdTHIRD-PARTY-NOTICES.mdregenerated if dependencies changed — no dependency changes🤖 Generated with Claude Code