refactor: extract logOutboundRPCRequest helper; complete flags.go env-var table#3888
Merged
refactor: extract logOutboundRPCRequest helper; complete flags.go env-var table#3888
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/e8ae36d4-4bd4-4cfc-8485-ec88e9301b82 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add duplicate code analysis report for Go files
refactor: extract logOutboundRPCRequest helper; complete flags.go env-var table
Apr 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces small duplication in MCP request logging by extracting an outbound RPC logging helper to mirror the existing inbound helper, and it completes the CLI flag helper-to-env-var inventory comment for tracing defaults.
Changes:
- Extract
logOutboundRPCRequestininternal/mcp/connection.goand use it fromSendRequestWithServerIDto match the existing inbound response helper. - Update
internal/cmd/flags.go’sgetDefault*helper table to include the tracing helpers and their environment variables.
Show a summary per file
| File | Description |
|---|---|
| internal/mcp/connection.go | Adds logOutboundRPCRequest helper and replaces inline outbound logging block in SendRequestWithServerID. |
| internal/cmd/flags.go | Completes the documented mapping for tracing-related getDefault* helpers to OTEL env vars. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
This was referenced Apr 15, 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.
Two low-to-medium severity duplication patterns identified in commit ca03645. The inbound response logging was already abstracted into
logInboundRPCResponse; the outbound request side was left inline, and theflags.gohelper table was missing its tracing entries.Changes
internal/mcp/connection.go— ExtractlogOutboundRPCRequesthelper, symmetric with the existinglogInboundRPCResponse. Replaces the inlineif shouldAttachAgentTagsblock inSendRequestWithServerID:internal/cmd/flags.go— Add the two missing tracing helpers to thegetDefault*inventory table (getDefaultOTLPEndpoint→OTEL_EXPORTER_OTLP_ENDPOINT,getDefaultOTLPServiceName→OTEL_SERVICE_NAME). The one-liner-per-file pattern remains intentional; this is a documentation completeness fix.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:
example.com/tmp/go-build540237260/b514/launcher.test /tmp/go-build540237260/b514/launcher.test -test.testlogfile=/tmp/go-build540237260/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s E=3 t.go olang.org/grpc@v-ifaceassert x_amd64/compile . /tmp/cgo-gcc-inp/usr/bin/runc x_amd64/asm x_amd64/compile -I cfg -I x_amd64/vet --gdwarf-5 g/grpc/connectiv/usr/bin/runc -o x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build540237260/b496/config.test /tmp/go-build540237260/b496/config.test -test.testlogfile=/tmp/go-build540237260/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build540237260/b394/vet.cfg @v1.1.3/cpu/x86/go1.25.8 -I x_amd64/vet --gdwarf-5 ing/prototext -o x_amd64/vet -I ify@v1.11.1/asse-errorsas ify@v1.11.1/asse-ifaceassert x_amd64/vet --gdwarf-5 telabs/wazero/in-atomic -o x_amd64/vet(dns block)nonexistent.local/tmp/go-build540237260/b514/launcher.test /tmp/go-build540237260/b514/launcher.test -test.testlogfile=/tmp/go-build540237260/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s E=3 t.go olang.org/grpc@v-ifaceassert x_amd64/compile . /tmp/cgo-gcc-inp/usr/bin/runc x_amd64/asm x_amd64/compile -I cfg -I x_amd64/vet --gdwarf-5 g/grpc/connectiv/usr/bin/runc -o x_amd64/vet(dns block)slow.example.com/tmp/go-build540237260/b514/launcher.test /tmp/go-build540237260/b514/launcher.test -test.testlogfile=/tmp/go-build540237260/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s E=3 t.go olang.org/grpc@v-ifaceassert x_amd64/compile . /tmp/cgo-gcc-inp/usr/bin/runc x_amd64/asm x_amd64/compile -I cfg -I x_amd64/vet --gdwarf-5 g/grpc/connectiv/usr/bin/runc -o x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build540237260/b523/mcp.test /tmp/go-build540237260/b523/mcp.test -test.testlogfile=/tmp/go-build540237260/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s -I cfg om/modelcontextprotocol/go-sdk@v1.5.0/mcp/cmd.go x_amd64/vet --gdwarf-5 g/grpc/grpclog/i-test.testlogfile=/tmp/go-build540237260/b508/testlog.txt -o x_amd64/vet cfg 0015561/b465/_pkg_.a -o/tmp/go-build1700015561/b288//-ifaceassert x_amd64/vet -c /cobra /tmp/go-build1700015561/b288/ _txqEVX/1qvAIR51hsPXl6lP0GEp(dns block)If you need me to access, download, or install something from one of these locations, you can either: