diff --git a/internal/cmd/flags.go b/internal/cmd/flags.go index 8bc80053..afd97f79 100644 --- a/internal/cmd/flags.go +++ b/internal/cmd/flags.go @@ -39,6 +39,8 @@ // flags_difc.go getDefaultAllowOnlyOwner() → MCP_GATEWAY_ALLOWONLY_SCOPE_OWNER // flags_difc.go getDefaultAllowOnlyRepo() → MCP_GATEWAY_ALLOWONLY_SCOPE_REPO // flags_difc.go getDefaultAllowOnlyMinIntegrity() → MCP_GATEWAY_ALLOWONLY_MIN_INTEGRITY +// flags_tracing.go getDefaultOTLPEndpoint() → OTEL_EXPORTER_OTLP_ENDPOINT +// flags_tracing.go getDefaultOTLPServiceName() → OTEL_SERVICE_NAME // // This pattern is intentionally kept in individual feature files because: // - Each helper names the specific environment variable it reads, making the diff --git a/internal/mcp/connection.go b/internal/mcp/connection.go index 5c828284..aaa85b3e 100644 --- a/internal/mcp/connection.go +++ b/internal/mcp/connection.go @@ -417,6 +417,16 @@ func (c *Connection) callSDKMethodWithReconnect(method string, params interface{ return result, err } +// logOutboundRPCRequest logs an outbound RPC request, optionally attaching agent DIFC tag snapshots. +// When shouldAttachTags is true, snapshot must be non-nil. +func logOutboundRPCRequest(serverID string, method string, payload []byte, shouldAttachTags bool, snapshot *AgentTagsSnapshot) { + if shouldAttachTags { + logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, payload, snapshot.Secrecy, snapshot.Integrity) + } else { + logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, payload) + } +} + // logInboundRPCResponse logs an inbound RPC response, optionally attaching agent DIFC tag snapshots. // When shouldAttachTags is true, snapshot must be non-nil. func logInboundRPCResponse(serverID string, payload []byte, err error, shouldAttachTags bool, snapshot *AgentTagsSnapshot) { @@ -445,11 +455,7 @@ func (c *Connection) SendRequestWithServerID(ctx context.Context, method string, "method": method, "params": params, }) - if shouldAttachAgentTags { - logger.LogRPCRequestWithAgentSnapshot(logger.RPCDirectionOutbound, serverID, method, requestPayload, snapshot.Secrecy, snapshot.Integrity) - } else { - logger.LogRPCRequest(logger.RPCDirectionOutbound, serverID, method, requestPayload) - } + logOutboundRPCRequest(serverID, method, requestPayload, shouldAttachAgentTags, snapshot) var result *Response var err error