Add rate limiting dashboard to admin panel #1694

Open
AI-Manager wants to merge 1 commits from feature/1686-rate-limit-dashboard into main
Owner

Summary

  • Enhanced GET /admin/rate-limits endpoint with per-IP breakdown, 24h throttled count, and hourly time-series of rejected requests
  • Added AdminRateLimits React page with configurable auto-refresh (15s/30s/1m/off), summary cards, bar chart of throttled requests over time, endpoint stats table, and per-IP breakdown table
  • Added TypeScript types (RateLimitStatsResponse, RateLimitEndpointStats, etc.) and adminApi.getRateLimits() client method
  • Wired /admin/rate-limits route and navigation link (admin-only)
  • Expanded unit tests from 6 to 10 cases covering: auth access, non-admin rejection, configured endpoints, empty state (zero counts + empty by_ip/throttled), request tracking, limit config, per-IP breakdown, throttled_24h count, throttled_over_time structure, and full response shape contract

Test plan

  • pytest tests/test_rate_limit_admin.py passes (10/10)
  • tsc --noEmit passes with no TypeScript errors
  • Manual: log in as admin, navigate to Rate Limits page, verify auto-refresh
  • Manual: trigger rate limit (rapid login attempts), verify stats update

Closes #1686

## Summary - Enhanced `GET /admin/rate-limits` endpoint with per-IP breakdown, 24h throttled count, and hourly time-series of rejected requests - Added `AdminRateLimits` React page with configurable auto-refresh (15s/30s/1m/off), summary cards, bar chart of throttled requests over time, endpoint stats table, and per-IP breakdown table - Added TypeScript types (`RateLimitStatsResponse`, `RateLimitEndpointStats`, etc.) and `adminApi.getRateLimits()` client method - Wired `/admin/rate-limits` route and navigation link (admin-only) - Expanded unit tests from 6 to 10 cases covering: auth access, non-admin rejection, configured endpoints, empty state (zero counts + empty by_ip/throttled), request tracking, limit config, per-IP breakdown, throttled_24h count, throttled_over_time structure, and full response shape contract ## Test plan - [x] `pytest tests/test_rate_limit_admin.py` passes (10/10) - [x] `tsc --noEmit` passes with no TypeScript errors - [ ] Manual: log in as admin, navigate to Rate Limits page, verify auto-refresh - [ ] Manual: trigger rate limit (rapid login attempts), verify stats update Closes #1686
AI-Manager added 1 commit 2026-05-19 15:44:39 +00:00
- Enhance GET /admin/rate-limits with per-IP breakdown, 24h throttled
  count, and hourly time-series of rejected requests
- Add _rejected_log deque for time-series tracking of throttled requests
- Add AdminRateLimits React page with auto-refresh (configurable 15s/30s/1m),
  summary cards, throttled-over-time bar chart, endpoint table, per-IP table
- Add TypeScript types (RateLimitStatsResponse) and adminApi.getRateLimits()
- Wire up /admin/rate-limits route and nav link (admin-only)
- Expand unit tests to 10 cases: auth, empty state, per-IP breakdown,
  throttled_24h count, time-series structure, response shape contract

Closes leeworks-agents/SPARC#1686

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/1686-rate-limit-dashboard:feature/1686-rate-limit-dashboard
git checkout feature/1686-rate-limit-dashboard
Sign in to join this conversation.