Fix duplicate HTTP request/response log statements between sendHTTPRequest and executeHTTPRequest - #4606
Conversation
…TTPRequest Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/496397d9-38d0-4f5d-8b3d-5cfbf9a58d3c Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR reduces duplicate HTTP request/response debug logging by removing the “Sending HTTP request …” and “Received HTTP response …” logConn.Printf statements from sendHTTPRequest, relying on executeHTTPRequest’s logging instead.
Changes:
- Removed connection-namespace send/receive log lines from
sendHTTPRequestto avoid duplicate per-round-trip logs. - Left
executeHTTPRequestas the single source of “request executing” / “response received” HTTP logs.
Show a summary per file
| File | Description |
|---|---|
internal/mcp/http_transport.go |
Removes duplicate request/response log statements from sendHTTPRequest to reduce log noise. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| requestID := atomic.AddUint64(&requestIDCounter, 1) | ||
| logConn.Printf("Sending HTTP request to %s: method=%s, id=%d", c.httpURL, method, requestID) | ||
|
|
||
| result, err := c.executeHTTPRequest(ctx, method, params, requestID, headerModifier) | ||
| if err != nil { |
There was a problem hiding this comment.
By removing the request/response logs here, HTTP round-trip visibility now depends entirely on the mcp:http_transport logger (i.e., DEBUG=mcp:connection will no longer show any per-request send/receive lines). If the intent is only to remove duplicates under DEBUG=mcp:* while preserving the existing mcp:connection behavior, consider emitting the logConn lines conditionally (e.g., only when !logHTTP.Enabled()), or otherwise ensuring the connection-level logger still provides a single request/response pair.
|
@copilot address this review feedback #4606 (review) |
…d duplicates Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/cc765c0e-bb93-4fa3-b128-7ea8cf2150f2 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Addressed in 6b00f8f. The
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
sendHTTPRequestand its calleeexecuteHTTPRequestboth logged HTTP request dispatch and response receipt, producing 4 log lines per round-trip underDEBUG=mcp:*instead of 2.Changes
internal/mcp/http_transport.go: ThelogConn.Printfcalls for "Sending HTTP request" and "Received HTTP response" insendHTTPRequestare now guarded with!logHTTP.Enabled(), preventing duplicate output when the more-detailedmcp:http_transportlogger is active while preservingmcp:connectionvisibility when it is not:This means:
DEBUG=mcp:*— onlylogHTTPfires (no duplicates)DEBUG=mcp:connection—logConnfires as before (single pair per round-trip)DEBUG=mcp:http_transport— onlylogHTTPfires (no duplicates)