Repository navigation
feat(usage): add the event Usage page and CSV export (#1166) - #1481
shashank03-dev wants to merge 8 commits into
Conversation
…g per event Counts are kept in memory where the work happens and added to hourly usage_records rows every 60 s, after a transcription worker stops and at shutdown. Staff WHEP players are marked with ?monitor=1 so listening time leaves them out. Part of fossasia#1166.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
Reviewer's GuideSchema and migrationsAdd the hourly usage-records table, its event cascade and unique bucket index, and the ORM model that maps to it.
Data structuresTrack the room, language, booth and connection time for each TTS subscription so the listening sampler can attribute AI-translation listeners.
APIExpose owner-only usage and CSV endpoints that combine saved and pending counts, apply UTC date filters, and produce formula-safe daily exports.
Uses of the APIMark interpreter and staff monitoring WHEP players so their sessions are excluded from listener totals.
Record transcription audio read by providers and request a prompt flush when a transcription worker exits.
Count translation text sent to engines, including timed-out or cancelled calls, once per target language.
Attach event and provider metadata to voice configuration and count the PCM audio produced under the provider's resolved voice.
ImplementationImplement in-memory hourly counters, batched persistence and shutdown retries, audio metering, listener sampling, and daily report aggregation.
Give TTS providers a common voice-resolution method so usage records identify the voice actually spoken.
Map workspace usage URLs to their admin-route equivalents.
UIAdd the Usage quick-action tile to the event management page.
Render usage totals and room-level breakdowns with UTC date filters, CSV download and explanatory empty states.
ConfigurationStart and stop the usage meter and listening sampler with the application lifecycle, and register the usage router.
Add the Mission Control monitoring JavaScript check to the CI test workflow.
DocumentationDocument the usage-records table and add its migration to the database map.
Document the usage page and CSV routes in the route map.
Add usage tracking to the project component inventory and migration count.
Explain the Usage page, its metrics, sampling limits, date filters and CSV export for administrators.
TestsVerify interpreter monitoring URLs are marked and staff listening is excluded.
Test provider voice resolution through the shared TTS interface.
Cover usage counting, persistence and retries, listening attribution, page access, date filtering, workspace routing and CSV output.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…bad or repeated sessions
Fixes #1166
Built on #1480. This branch has #1480's commit too. Until #1480 merges, please review only dc0a3cc. Merge order: #1479, #1480, then this PR.
What it does: event owners get a Usage page that shows how much each room used: minutes of transcription, characters translated, minutes of AI voice, and how long listeners were connected. It is split by provider and model, with a UTC date range and a CSV export. It reads the counts #1480 saves, plus the ones not saved yet.
Who sees what: only the event owner and Admins. It opens from a new Usage tile on the event's workspace page. Coordinators and interpreters don't see the tile, and the page and CSV refuse them.
Why it's needed: after a 3 day event nobody can say how many transcription minutes ran on Deepgram, how many characters went to translation, or how many people listened. That makes provider bills hard to explain and the next event hard to size.
Tests: 7 page and CSV tests in
tests/test_usage.py(totals, dates, the empty page, owner and Admin access, deleted events, workspace paths). All fail ondev. Full suite 3887 passed.This recording covers the whole split (#1479, #1480 and #1481).
Before (
dev): a listener is live on the English booth, but the event page has no Usage tile, and/workspace/events/1/usage/and the CSV export both return 404.1166-before.mp4
After: with a listener on English audio and German AI translation, the new Usage page shows transcription, characters translated, listening and listener connections. Listening in from Mission Control on English adds no listener connection. The CSV returns 200 for the event owner and 403 for a room coordinator.
1166-after.mp4
Summary by Sourcery
Give event owners and Admins a per-event view of service usage with date-filtered CSV exports.
New Features:
Enhancements:
CI:
Documentation:
Tests:
Chores: