Repository navigation
Fix missing HTTP request metrics; demote success access logs to DEBUG - #1464
Conversation
DigiScriptServer.log_request overrode PrometheusMixIn.log_request without calling observe_request, so tornado_http_requests_total and tornado_http_request_duration_seconds never had samples. Observe requests before the ignored-route early return (guarded so metrics can't break requests), and log 1xx-3xx at DEBUG, 4xx at WARNING, 5xx at ERROR. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Client Test Results102 tests 102 ✅ 0s ⏱️ Results for commit 85b1c75. ♻️ This comment has been updated with latest results. |
Client V3 Test Results227 tests 227 ✅ 0s ⏱️ Results for commit 85b1c75. ♻️ This comment has been updated with latest results. |
Python Test Results 1 files 1 suites 1m 17s ⏱️ Results for commit 85b1c75. ♻️ This comment has been updated with latest results. |
Playwright E2E Results (firefox)227 tests 227 ✅ 2m 24s ⏱️ Results for commit 85b1c75. ♻️ This comment has been updated with latest results. |
Playwright E2E Results (chromium)227 tests 227 ✅ 2m 25s ⏱️ Results for commit 85b1c75. ♻️ This comment has been updated with latest results. |
Tim020
left a comment
There was a problem hiding this comment.
Review round 1
Head SHA: 753669b03ee2c829f2829994b6eae1998344c917
Verdict: Ready to merge once the suggestion below is considered; nothing blocking.
Previous round follow-up: none (first round, no existing threads).
SonarQube: Quality Gate passed (source: Sonar bot PR comment and SonarCloud check run; the API/MCP was not queried for line-level detail). 0 new issues, 0 security hotspots, 0.0% duplication on new code, coverage condition passing.
New findings: 0 Critical, 0 Important, 1 Suggestion (inline).
Strengths:
- Fixes the root cause:
observe_requestwas previously never called becauselog_requestwas overridden, sotornado_http_*metrics were missing. The newtest_http_request_metrics_exposedasserts this end to end. - Metrics are recorded before the ignored-logging early return, so
/debug/metricsscrapes are counted but not logged, and this is tested. - Good test coverage of all three log-level bands (DEBUG/WARNING/ERROR) and of the failure-swallowing path; docs updated to match.
Note: I could not inspect tornado_prometheus.PrometheusMixIn locally (package not installed in this environment), so I relied on the tests for the observe_request contract.
🤖 Generated with Claude Code
… WS 101 out of 5xx tornado_prometheus.classify_status_code buckets anything outside 200-499 as 5xx, so every WebSocket upgrade (101) was counted as a server error. Skip observe_request for 1xx. Run each observer independently and warn (with traceback) at most once per minute on failure, DEBUG otherwise. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review round 1 addressed in d76f3dc.
pytest 1162 passed, ruff clean. |
Tim020
left a comment
There was a problem hiding this comment.
Review round 2
Head SHA: 08c4cf1947d3d2e16ec81d274ce3fdb31e28fd08 (incremental diff since 753669b; it is an ancestor, so no force-push)
Verdict: Ready to merge.
Previous round follow-up: 1 verified fixed, 0 still open, 0 incomplete, 0 needing a human decision. The round 1 suggestion (independent observers, failures visible above DEBUG) is fixed in _observe_metrics and the thread is resolved.
SonarQube: Quality Gate passed (source: Sonar bot PR comment and check run; API not queried). 0 new issues, 0.0% duplication on new code; the coverage condition passes. Other CI checks pass; Build Server (linux/windows) was still pending when I looked.
New findings: none.
Strengths:
- The author found and fixed a real related bug:
tornado_prometheusclassifies any status outside 200-499 as5xx, so every WebSocket 101 upgrade was counted as a server error. Skipping 1xx forobserve_requestis a sound, minimal fix, with a regression test and docs. - The warn-once rate limit is simple and tested.
- Minor nit, non-blocking:
test_websocket_upgrade_not_counted_as_5xxrelies on a fixed 0.2s sleep, which could be slightly flaky on slow CI, though the author reports it fails without the fix.
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Round 2 nit addressed in 85b1c75. Finding: |
|
Tim020
left a comment
There was a problem hiding this comment.
Review round 3
Head SHA: 85b1c758b19dd8c39dc8ad9c67f50113cbf6b3a4 (incremental diff since 08c4cf1; ancestor, no force-push)
Verdict: Ready to merge.
Previous round follow-up: no open threads (the round 1 thread was resolved earlier). The round 2 non-inline nit (fixed 0.2s sleep in test_websocket_upgrade_not_counted_as_5xx) is verified fixed: the test now wraps log_request, sets an asyncio.Event once the 101 request is handled, and waits on it with a 10s bound. Patching the instance attribute works because Tornado calls application.log_request(handler), and the original bound method is captured before the patch, so there is no recursion.
SonarQube: Quality Gate passed (source: Sonar bot PR comment; API not queried). 0 new issues.
New findings: none. The only change since round 2 is this test-only commit.
Strengths: the flaky-test fix replaces a time-based wait with an event-based one and keeps the regression property (the author reports the test still fails without the 1xx skip).
🤖 Generated with Claude Code



Summary
Test plan
🤖 Generated with Claude Code