feat: add tracking for auth request success and failure counts

- Introduced `Success` and `Failed` fields in auth records to track request outcomes.
- Updated `/v0/management/auth-files` and `/v0/management/api-key-usage` responses to include success and failure counts.
- Enhanced tests to validate tracking logic and API responses.
This commit is contained in:
Luis Pater
2026-05-02 03:40:00 +08:00
parent 8c2f1a80d3
commit b8bba053fc
7 changed files with 103 additions and 13 deletions
@@ -62,6 +62,13 @@ func TestListAuthFiles_IncludesRecentRequestsBuckets(t *testing.T) {
t.Fatalf("expected file entry object, got %#v", filesRaw[0])
}
if _, ok := fileEntry["success"].(float64); !ok {
t.Fatalf("expected success number, got %#v", fileEntry["success"])
}
if _, ok := fileEntry["failed"].(float64); !ok {
t.Fatalf("expected failed number, got %#v", fileEntry["failed"])
}
recentRaw, ok := fileEntry["recent_requests"].([]any)
if !ok {
t.Fatalf("expected recent_requests array, got %#v", fileEntry["recent_requests"])