feat: Trace weather agent to MCP gateway tool calls#145
feat: Trace weather agent to MCP gateway tool calls#145evaline-ju merged 5 commits intokagenti:mainfrom
Conversation
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
0839ef2 to
0e77b2f
Compare
mrsabath
left a comment
There was a problem hiding this comment.
Review Summary
Clean, focused PR that adds end-to-end distributed tracing from the weather agent through to MCP gateway tool calls. Two key changes: (1) adds opentelemetry-instrumentation-httpx for automatic traceparent propagation on outgoing HTTP requests, and (2) switches the tracing middleware from creating root spans to joining incoming W3C trace context. Both changes are correct for the distributed tracing use case.
Areas reviewed: Python, Dependencies, Security
Commits: 3 commits, all signed-off: yes
CI status: DCO pass, build pass
🤖 Reviewed with Claude Code
| logger.info("httpx instrumented for automatic trace context propagation") | ||
| except ImportError: | ||
| logger.warning("opentelemetry-instrumentation-httpx not available - " | ||
| "MCP tool calls will not propagate trace context") |
There was a problem hiding this comment.
praise: Good approach — instrumenting httpx at the SDK level means all outgoing HTTP calls (including MCP tool calls via langchain-mcp-adapters' streamable_http transport) automatically propagate traceparent. No per-call instrumentation needed, and the graceful ImportError fallback is clean.
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Summary
MCP gateway otel changes are in v0.5.1
For the weather agent, be able to trace agent calls to tool calls through Envoy+MCP gateway, all linked to the same root span.
Related issue(s)
For tracing from agent->MCP gateway for kagenti/kagenti#619