feat: add support for recent request tracking in auth records

- Implemented `RecentRequestsSnapshot` in `Auth` to capture bucketed recent request data.
- Added new fields and methods to `Auth` for tracking request success and failure counts over time.
- Updated `/v0/management/auth-files` response to include recent request data for each auth record.
- Introduced unit tests to validate request tracking and snapshot generation logic.
This commit is contained in:
Luis Pater
2026-05-01 22:55:22 +08:00
parent 4035abc0cd
commit 6187919000
6 changed files with 294 additions and 2 deletions
+1
View File
@@ -2021,6 +2021,7 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) {
m.mu.Lock()
if auth, ok := m.auths[result.AuthID]; ok && auth != nil {
now := time.Now()
auth.recordRecentRequest(now, result.Success)
if result.Success {
if result.Model != "" {