Skip to content

Skip WARN for non-POST Streamable HTTP requests#5221

Merged
danbarr merged 1 commit intomainfrom
fix/quiet-streamable-http-non-jsonrpc-warn
May 7, 2026
Merged

Skip WARN for non-POST Streamable HTTP requests#5221
danbarr merged 1 commit intomainfrom
fix/quiet-streamable-http-non-jsonrpc-warn

Conversation

@danbarr
Copy link
Copy Markdown
Collaborator

@danbarr danbarr commented May 7, 2026

Summary

The telemetry middleware logs WARN for every request where the MCP parser produces no method, treating an absent method as a misconfiguration. That assumption only holds for POST (which carries the JSON-RPC body): per the MCP Streamable HTTP transport, GET opens an SSE stream and DELETE terminates a session, neither of which has a JSON-RPC method to extract. Operator-driven session traffic and keepalives produced one WARN per pod every ~30 seconds, drowning real signal in cluster logs.

This change gates the warning on r.Method == http.MethodPost so genuine misconfiguration on the JSON-RPC path still surfaces while valid lifecycle requests stay quiet. Recording of mcp.server.operation.duration is unchanged: it was already gated on mcpMethod != "unknown".

Fixes #4451

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Test plan

  • Added TestHTTPMiddleware_UnknownMethodWarning covering the full truth table: POST with a parsed method (no warn, duration recorded), POST without a parsed method (warns with http_method and path attrs, no duration), GET and DELETE to /mcp (no warn, no duration).
  • task lint-fix clean.
  • 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 misconfigured log lines stop appearing for normal Streamable HTTP traffic.

🤖 Generated with Claude Code

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>
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label May 7, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.81%. Comparing base (c90d01e) to head (13ff618).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@danbarr danbarr merged commit 7385e26 into main May 7, 2026
44 checks passed
@danbarr danbarr deleted the fix/quiet-streamable-http-non-jsonrpc-warn branch May 7, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spurious WARN audit logs for non-JSON-RPC MCP Streamable HTTP requests

2 participants