Skip to content

feat(admin): show progressive hourly gateway usage - #5874

Open
chrarnoldus wants to merge 1 commit into
mainfrom
feat/gateway-hourly-progressive-usage
Open

feat(admin): show progressive hourly gateway usage#5874
chrarnoldus wants to merge 1 commit into
mainfrom
feat/gateway-hourly-progressive-usage

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • Replace daily gateway usage queries with sequential, fixed one-hour UTC queries while preserving the current inclusive date-range and model selectors.
  • Keep PostgreSQL read-replica execution, production primary-fallback protection, positive input-token filtering, user-BYOK exclusion, and the existing ten-minute timeout per query.
  • Publish immutable hourly snapshots into the React Query cache as queries finish, so the table and spreadsheet copy update while later hours are running.
  • Keep completed rows visible on later failures, clearly label partial results/exports, and reset previous results when restarting a range.
  • Include hour_start in results and TSV; preserve exact numeric strings and keep hourly distinct-user counts separate.

Validation

  • Added hourly SQL boundary/input/replica/abort coverage and sequential-runner/React Query observer coverage for incremental results, failures, and reruns.
  • Tests intentionally left to CI as requested.
  • Formatting and git diff --check passed. pnpm validation commands triggered dependency refresh and exceeded this container's two-minute limit; installed check tools were also invoked directly.
  • UI follows the Cloud overlay and interaction-quality guidance; no unrelated design changes.

Cancellation

  • Request cancellation stops further hourly scheduling and is checked before SQL starts after connection acquisition. Already-running PostgreSQL work can continue until completion or its statement timeout.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus chrarnoldus self-assigned this Sep 4, 2026
@kilo-code-bot

kilo-code-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • apps/web/src/app/admin/gateway/UsageContent.tsx
  • apps/web/src/app/admin/gateway/gateway-usage-report.ts
  • apps/web/src/app/admin/gateway/gateway-usage-report.test.ts
  • apps/web/src/routers/admin/gateway-usage-router.ts
  • apps/web/src/routers/admin/gateway-usage-router.test.ts

Reviewed by grok-4.6 · Input: 89.1K · Output: 18.1K · Cached: 617.6K

Review guidance: REVIEW.md from base branch main

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.

1 participant