Admin: live per-minute API usage monitor (spike detection)#111
Merged
Conversation
The admin dashboard only bucketed activity by day, useless for an hour-long workshop. Add a 'live-usage' organizer-only edge action that buckets the last N minutes (default 120) of API calls (assistant messages) and provider_error events per minute, and a Live API Usage panel that auto-refreshes every 20s with peak calls/min, totals, and a per-minute bar chart (minutes with errors flagged red). Lets the organizer watch load and rate-limit spikes in near real time.
✅ Deploy Preview for ai2aichat ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Answers 'can we see usage spikes in admin?'. The dashboard was day-bucketed — blind to an hour-long workshop.
Edge (
workshop-config): new organizer-gatedlive-usageaction. Buckets the last N minutes (default 120) per minute: API calls = assistant messages (each AI turn is one provider call), errors = provider_error events (rate limits/failures). Returns a gap-filled minute series + peak calls/min + totals. Reuses existing data — no new tracking writes.UI (
AdminDashboard): new Live API Usage panel — auto-refreshes every 20s (toggle + manual refresh), shows peak calls/min, 2h totals, and a per-minute bar chart with error-minutes flagged red. Slotted above the daily timeline.Requires edge redeploy (with --no-verify-jwt). Tests 35/35 ✓, build ✓, lint ✓.