Remove MCP metrics merge residue from request counting - #2044
groupthinking with Copilot wants to merge 2 commits into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Repository: groupthinking/EventRelay/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependency Review SummaryThe full dependency review summary was too large to display here (13153KB, limit is 1024KB). Please download the artifact named "dependency-review-summary" to view the complete report. |
🔍 PR Validation |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The canonical application does not install the metrics middleware, so the v1 route loses request metrics entirely.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
What changed in this PR
Updates backend request metrics to avoid duplicate counters and expose request counts.
Changes:
- Centralizes request counting in metrics middleware.
- Removes route-level duplicate increments.
- Adds middleware regression coverage.
| File | Description |
|---|---|
tests/unit/test_middleware.py |
Tests labeled metrics and request-count headers. |
src/youtube_extension/backend/middleware/metrics.py |
Records requests once and sets the count header. |
src/youtube_extension/backend/main.py |
Removes legacy route-level counting. |
src/youtube_extension/backend/api/v1/router.py |
Removes v1 markdown route counting. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -781,7 +781,6 @@ async def process_video_markdown_v1( | |||
| status_code=status.HTTP_429_TOO_MANY_REQUESTS, detail="Rate limit exceeded" | |||
| ) | |||
|
|
|||

Canonical issue
Canonical issue linkage is handled by the system.
Outcome
Request metrics now count each HTTP request once, emit valid labeled Prometheus lines, and expose a stable
X-Request-Countheader derived from the application request tracker.Scope
requests_totalfor the same requestX-Request-Countfromapplication_checker.request_countrequests_totalincrements from markdown endpoints that were double-counting requests already covered by middlewarerequests_totalemission and monotonicX-Request-CountRisk
requests_totalinflation would observe lower, correct countsVerification
Exact checks on head
33cf0e85b2e9a91aeb7ba0654be25766806000a9.PYTHONPATH=src python -m pytest tests/unit/test_middleware.py tests/unit/test_health_monitoring_service.py tests/unit/test_health_monitoring_extra.py tests/unit/test_v1_router_extended.py -k 'PrometheusMetricsMiddleware or IncrementMetric or GetMetricsPrometheusFormat or get_metrics_prometheus or MetricsEndpoint' --no-cov -quvai_requests_total{method="GET",endpoint="/test",status="200"} 1.0Production evidence
Not applicable for this change set. This is backend request-metrics behavior with unit-level and direct runtime verification only; no Vercel preview or production deployment evidence was generated in-session.
Agent handoff