Skip to content

CI only: #608 + #613 + #614 stack (do not merge) - #615

Closed
okdaichi wants to merge 11 commits into
mainfrom
ccr-2161bc2c-wkewvo-ingest-usage
Closed

okdaichi wants to merge 11 commits into
mainfrom
ccr-2161bc2c-wkewvo-ingest-usage

Conversation

@okdaichi

Copy link
Copy Markdown
Collaborator

Temporary draft to run full CI on the top of the #608 → #613 → #614 stack, which targets other branches and so runs only check-changelog. It will be closed once CI finishes; do not merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KPWMJNAzsnsiqRPREa2JqY

claude and others added 11 commits November 17, 2026 17:51
What sends usage records to QUMO_USAGE_URL moves out of the relay's
verifier into internal/meter: sessions (Open, Report, Close), running
totals per key (Total), coalescing, batches of 500, retries through an
outage, signing and the last send at shutdown. The relay keeps only its
own decisions (a publisher by itself, viewers in one total per key) in
internal/auth. The records it sends are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJL7PH3rPhK5UTGavaB
- The check that a key-set or usage URL is https, or http only to a
  loopback host, was in internal/auth and copied into internal/meter. It
  is now reqsign.CheckURL, beside the other rules for requests to the
  control plane (NoRedirectClient, Refusals), so the two can't drift.
- meter.Reporter.now was never overridden; it uses time.Now.
- usageReporter.flush existed only for tests; they call meter.Flush.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJL7PH3rPhK5UTGavaB
…opted into HLS and ABR

A publishing session's usage and session_close records now carry
gateway.opt_in_seconds.abr and .hls (usage.OptInSeconds): the whole
seconds its announcements beneath /.abr/ and /.hls/ lasted on the relay,
added up over its broadcasts. Only an opt-in the session's grant covers
reaches the relay, and moqt ends one a revoked ticket no longer covers, so
the time is billed to the key that holds the opt-in. qumo abr never needs
to know whose broadcast it transcodes.

- relay: optInClock counts each checked session's opt-in announcements
  while they last; the lease sends its totals with each revalidate and
  reportEnd with the end (auth.Request.OptIns).
- auth: a publisher's records carry them; a viewer's total does not.
- optin.Of names the egress a path opts into; ingest uses it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJL7PH3rPhK5UTGavaB
… key

With QUMO_USAGE_URL and QUMO_AUTH_KEYS, qumo rtmp and qumo rtsp-push send
each stream to the usage URL as a relay sends a publishing session: an
open, usage every 30 s and a close, under the kid of the token that
granted the push, with the media the ingest took in (ingest.media_bytes)
and how long it kept the broadcast opted into each egress. The relay only
sees the ingest's own session, so a stream pushed over RTMP or RTSP is
billed to its publisher here.

- ingest.PublishAuthorizer returns a Permission: the lapse, and the kid
  of the key that granted it.
- Session counts the media pushed into it and its opt-in time (Usage).
- The opt-in clock moved from the relay to internal/optin (optin.Clock),
  which both use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJL7PH3rPhK5UTGavaB
A publisher that opted anything in sent a usage record at every revalidate,
even with no bytes moved and under a whole second opted in. It now reports
only when a metric is positive, as before #613 for bytes.

The opt-in clock reads time.Now itself; its tests run in a synctest bubble
instead of passing a fake clock through the constructor. TestOf uses
subtests; two doc comments are rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJNAzsnsiqRPREa2JqY
…hare the whole-seconds rule

TestRTMPServer_Meter flushed the meter once the broadcast was announced,
but the stream's usage report opens after that, so the sink often got
nothing. It now flushes until the open arrives.

TestMeterStream runs its stream in a synctest bubble instead of sleeping
for real time.

The rule turning opt-in time into whole-second metrics was written in
both auth and ingest; optin.AddSeconds is now the one copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJNAzsnsiqRPREa2JqY
The opt-in clock now lives in internal/optin: NewClock takes no clock and
its tests run in a synctest bubble, as in #613.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPWMJNAzsnsiqRPREa2JqY
@okdaichi

Copy link
Copy Markdown
Collaborator Author

CI passed on the stack top (8568489); closing as planned.

@okdaichi okdaichi closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants