@@ -126,9 +126,8 @@ def setup_observability() -> None:
126126 ]))
127127
128128 # Instrument httpx for automatic traceparent propagation on outgoing requests.
129- # This is critical for distributed tracing: langchain-mcp-adapters uses httpx
130- # for streamable_http transport, so each MCP tool call will automatically carry
131- # the current span's traceparent header to the MCP gateway (Envoy).
129+ # langchain-mcp-adapters uses httpx for streamable_http transport, so each MCP
130+ # tool call will automatically carry the current span's traceparent header
132131 try :
133132 from opentelemetry .instrumentation .httpx import HTTPXClientInstrumentor
134133 HTTPXClientInstrumentor ().instrument ()
@@ -408,7 +407,7 @@ def create_tracing_middleware():
408407
409408 async def tracing_middleware (request : Request , call_next ):
410409 # Skip non-API paths (health checks, agent card, etc.)
411- if request .url .path in ["/health" , "/ready" , "/.well-known/agent-card.json" ]:
410+ if request .url .path in ["/health" , "/ready" , "/.well-known/agent-card.json" , "/.well-known/agent.json" ]:
412411 return await call_next (request )
413412
414413 tracer = get_tracer ()
@@ -433,10 +432,8 @@ async def tracing_middleware(request: Request, call_next):
433432 except Exception as e :
434433 logger .debug (f"Could not parse request body: { e } " )
435434
436- # Extract incoming W3C Trace Context from request headers.
437- # If the request carries a traceparent (e.g., from Envoy/MCP gateway or
438- # an upstream orchestrator), the root span becomes a child of that trace.
439- # This is what connects the agent's spans to the MCP gateway's spans.
435+ # Extract incoming W3C Trace Context from request headers to connect
436+ # agent spans to MCP gateway spans
440437 incoming_ctx = extract (dict (request .headers ))
441438 detach_token = context .attach (incoming_ctx )
442439
0 commit comments