feat(sharing-server): admin token usage dashboard#694
Merged
Conversation
- New /admin route (admin-only, redirects non-admins to /dashboard) - Per-user summary table showing 30d input/output tokens, interactions, days active and last upload date - Overview stat cards for 7d / 30d / 90d with period toggle: total users, active users, total tokens, avg tokens per active user, interactions - Stacked trend chart (top-10 users + Others) with period toggle (7d / 30d / 90d) and mode toggle (Total / Per-User Average) Per-User Average mode shows a single-series bar: total tokens that day divided by the number of active users that day - Admin Panel link in the user dashboard header for admin users - New DB functions getAdminUserSummaries() and getAdminDailyTotals() using LEFT JOIN so zero-upload users still appear in the table - New idx_uploads_day index for efficient admin-wide day-range queries Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Custom domain managed certificates are only meaningful on stable, long-lived environments (production). Each testing branch gets a unique ACA FQDN (sharing-test-<slug>.azurecontainerapps.io) that already has Azure TLS — no custom cert needed. Setting SHARING_CUSTOM_DOMAIN on the testing GitHub environment caused every new branch deploy to provision a fresh cert via CNAME validation, which takes up to 60 minutes and fails if the CNAME points to a different ACA environment (as it always does for per-branch deploys). Changes: - Gate the Reconcile custom domain workflow step on is_prod == 'true' so it is skipped for all non-main branch deploys even if SHARING_CUSTOM_DOMAIN is accidentally set on the testing environment - Add a comment to main.tf explaining the custom_domain var is production-only Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Adds a dedicated
/adminpage to the sharing server so admins can see token usage across all registered users with trend and average views.What's new
/adminpage (admin-only)total tokens that day ÷ active users that dayUser dashboard
/admin.DB changes
getAdminUserSummaries(days)— LEFT JOIN users ↔ uploads so zero-upload users always appear in the table. Computes aggregated stats per user for the selected period.getAdminDailyTotals(days)— Per-day per-user totals for the trend chart.idx_uploads_dayindex for efficient admin-wide day-range queries.Testing
npm run check-types✅