Skip WARN for non-POST Streamable HTTP requests#5221
Merged
Conversation
The telemetry middleware logged WARN for every request where the MCP parser produced no method, treating absence of a method as a misconfig. That assumption holds for POST (which carries the JSON-RPC body) but not for valid Streamable HTTP lifecycle traffic: GET opens an SSE stream, DELETE terminates a session. Operator-driven sessions and keepalives produced one WARN per pod every ~30s, drowning real signals. Gate the warning on r.Method == POST so misconfiguration on the JSON-RPC path still surfaces while expected non-JSON-RPC requests stay quiet. Recording of mcp.server.operation.duration is unchanged. Fixes #4451 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5221 +/- ##
==========================================
- Coverage 67.83% 67.81% -0.02%
==========================================
Files 610 610
Lines 62397 62397
==========================================
- Hits 42325 42313 -12
- Misses 16900 16912 +12
Partials 3172 3172 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jhrozek
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The telemetry middleware logs
WARNfor every request where the MCP parser produces no method, treating an absent method as a misconfiguration. That assumption only holds forPOST(which carries the JSON-RPC body): per the MCP Streamable HTTP transport,GETopens an SSE stream andDELETEterminates a session, neither of which has a JSON-RPC method to extract. Operator-driven session traffic and keepalives produced oneWARNper pod every ~30 seconds, drowning real signal in cluster logs.This change gates the warning on
r.Method == http.MethodPostso genuine misconfiguration on the JSON-RPC path still surfaces while valid lifecycle requests stay quiet. Recording ofmcp.server.operation.durationis unchanged: it was already gated onmcpMethod != "unknown".Fixes #4451
Type of change
Test plan
TestHTTPMiddleware_UnknownMethodWarningcovering the full truth table:POSTwith a parsed method (no warn, duration recorded),POSTwithout a parsed method (warns withhttp_methodandpathattrs, no duration),GETandDELETEto/mcp(no warn, no duration).task lint-fixclean.go test -race ./pkg/telemetry/...passes.Does this introduce a user-facing change?
Yes for operators: spurious
mcp method could not be determined, middleware may be misconfiguredlog lines stop appearing for normal Streamable HTTP traffic.🤖 Generated with Claude Code