Repository navigation
Conversation
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
|
Test failed on
What I think is happening:
I'm re-running the failed job once. Fixing it belongs in its own change, either counting this case as superseded or registering before answering, not in this refactor. Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPWMJL7PH3rPhK5UTGavaB
…eter # Conflicts: # CHANGELOG.md
|
Integration failed on
What I think is happening:
I'm re-running the failed job once. Fixing it belongs in its own change: listen on Generated by Claude Code |
- 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
Description
This is the first of the usage-metering PRs. It moves the code that sends usage records to
QUMO_USAGE_URLout of the relay's verifier intointernal/meter, so ingest and hls can report through the same code. This PR changes no behaviour: the relay sends exactly the records it did before.The plan for the next PRs follows one rule, the same one the relay already uses: usage goes to the kid of the tenant token the server itself verified.
internal/meter, with the relay moved onto it./.abr/,/.hls/) on the session that announces them. A tenant then pays for ABR and HLS by opt-in time, andqumo abrnever needs to know whose broadcast it transcodes.Related Issue
None.
Changes
internal/meter:ReporterwithOpen,Report(cumulative, coalesced to the latest),Close,Forget,Total(one running total per key for the run, today'sviewersrecord),RunandFlush.Config.Name; for the relay that is stillrelay:.internal/auth/usage.go: keeps only the relay's own decisions:Testing
internal/auth: the existing usage tests pass after renaming two accessors (runID→meter.RunID(); one test now asserts nothing is sent instead of reading the pending queue).internal/meter:Runsends at the tick and at shutdown (synctest).-race.go test ./...passes; golangci-lint reports 0 issues; the relay session, ticket and anonymous integration tests pass.Checklist
Generated by Claude Code