Skip to content

feat: add per-protocol auth observability via RequestTags#49

Merged
wolfeidau merged 2 commits into
mainfrom
feat/auth-observability
Mar 22, 2026
Merged

feat: add per-protocol auth observability via RequestTags#49
wolfeidau merged 2 commits into
mainfrom
feat/auth-observability

Conversation

@wolfeidau
Copy link
Copy Markdown
Member

  • Add AuthOutcome field to RequestTags and SetAuthOutcome() setter in telemetry/tags.go
  • Update oidcMiddleware to call SetProtocol early (fixes empty protocol on 401/403) and set auth outcome at each exit point
  • Upgrade OIDC token validation failure log level from Debug to Info
  • Log auth_outcome field automatically via loggingMiddleware when set
  • Add content_cache_auth_requests_total counter (protocol + outcome labels) recorded in RecordHTTP
  • Add Auth dashboard section to Grafana with rate-by-outcome timeseries, failure rate stat, and per-protocol piechart
  • Codify metrics requirement in CLAUDE.md protocol checklist and code style

- Add AuthOutcome field to RequestTags and SetAuthOutcome() setter in telemetry/tags.go
- Update oidcMiddleware to call SetProtocol early (fixes empty protocol on 401/403) and set auth outcome at each exit point
- Upgrade OIDC token validation failure log level from Debug to Info
- Log auth_outcome field automatically via loggingMiddleware when set
- Add content_cache_auth_requests_total counter (protocol + outcome labels) recorded in RecordHTTP
- Add Auth dashboard section to Grafana with rate-by-outcome timeseries, failure rate stat, and per-protocol piechart
- Codify metrics requirement in CLAUDE.md protocol checklist and code style
…overage

- Add AuthOutcome type with named constants (Allowed/Unauthorized/Forbidden)
  to match the CacheResult pattern and eliminate stringly-typed values
- Log OIDC insufficient_permission at Info level, consistent with token
  validation failures
- Add comment to authMiddleware explaining the observability asymmetry
- Wire authRequestsTotal into setupTestMetrics and add RecordHTTP auth
  metric tests (outcome set and outcome absent)
- Add SetAuthOutcome unit tests to tags_test.go
- Add TestOIDCMiddleware_SetsAuthOutcomeTags covering all three exit paths
  with InjectTags so the assertions actually exercise the new code
@wolfeidau wolfeidau merged commit 183a96f into main Mar 22, 2026
1 check passed
@wolfeidau wolfeidau deleted the feat/auth-observability branch March 22, 2026 19:48
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