Skip to content

Commit 0e77b2f

Browse files
committed
Update uv.lock, remove polled spans, and update comments
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
1 parent 1625a4d commit 0e77b2f

3 files changed

Lines changed: 33 additions & 16 deletions

File tree

a2a/weather_service/src/weather_service/agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ async def execute(self, context: RequestContext, event_queue: EventQueue):
119119
# Test MCP connection first
120120
logger.info(f'Attempting to connect to MCP server at: {os.getenv("MCP_URL", "http://localhost:8000/sse")}')
121121

122-
# Trace context propagation to MCP gateway is handled automatically
123-
# by opentelemetry-instrumentation-httpx, which injects the current
124-
# span's traceparent header on every outgoing httpx request.
125122
mcpclient = get_mcpclient()
126123

127124
# Try to get tools to verify connection

a2a/weather_service/src/weather_service/observability.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

a2a/weather_service/uv.lock

Lines changed: 28 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)