Skip to content

Log only slow or failed MCP requests - #248

Merged
brianglass merged 1 commit into
mainfrom
trim-mcp-request-log
Oct 12, 2026
Merged

brianglass merged 1 commit into
mainfrom
trim-mcp-request-log

Conversation

@brianglass

Copy link
Copy Markdown
Owner

Why

#242's per-POST log found the 21s stalls (a subscriptions/listen stream, fixed in #243). From Oct 6 to 12 it recorded none: every Claude request finished in under 0.32s. It still writes about 2,500 lines a day, mostly an uptime monitor's pings.

What

log_mcp_requests keeps the "stage": "slow" snapshot at 5s. It now writes a "done" line only for requests that were slow, ended in a 5xx or with no response, or raised. Fast, successful requests log nothing. It stays in place as a cheap early warning in case a future protocol change brings in another long-lived request.

Test plan

  • New tests: fast successful requests log nothing; a 503 is logged
  • Existing tests updated to use a slow or failing app; mcp_svc passes (27 tests)

🤖 Generated with Claude Code

#242's per-POST log found its cause (subscriptions/listen, fixed in
#243) and has shown none since: over Oct 6-12, every Claude request
finished in under 0.32s. It still writes ~2,500 lines a day, mostly
an uptime monitor's pings. Keep it as a cheap early warning instead:
the "slow" snapshot at 5s, plus a "done" line only for requests that
were slow, ended in a 5xx or no response, or raised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brianglass
brianglass merged commit 6948b64 into main Oct 12, 2026
4 checks passed
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