feat: metrics middleware for http handlers in admin api #7229
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7229"
general
weight: 0.35
garrickdabbs
https://redhat.atlassian.net/browse/ARO-29406
What
This adds the counter admin_http_requests_total and the histogram admin_http_requests_duration_seconds to the admin api HTTP handlers. The implementation mirrors that of the frontend api.
Why
The admin api currently does not have any metrics for HTTP handlers. Having these metrics metrics makes dashboards and alerting at the handler level possible for an externally facing api.
Testing
Unit tests added for the metrics middleware.
Integration tests passing.
Ran the e2e serial console log test against personal dev environment:
Verified the metrics endpoint via Grafana, which shows routes/codes expected from manual testing and e2e test execution:
<img width="1373" height="963" alt="image" src="https://github.com/user-attachments/assets/b833a579-eff5-4887-a349-15f4cd5cb4af" />
The
401 <no match>entries were confirmed to be random/mcptraffic, and401 <no match>is the expected behavior for these requests:PR Checklist
If E2E tests are included:
demonstrate that the test is able to detect a defect/error and fail with
proper error message and logs which communicates nature of the problem.