Skip to content

feat: Trace weather agent to MCP gateway tool calls#145

Merged
evaline-ju merged 5 commits intokagenti:mainfrom
evaline-ju:weather-trace-langchain
Apr 1, 2026
Merged

feat: Trace weather agent to MCP gateway tool calls#145
evaline-ju merged 5 commits intokagenti:mainfrom
evaline-ju:weather-trace-langchain

Conversation

@evaline-ju
Copy link
Copy Markdown
Contributor

@evaline-ju evaline-ju commented Mar 3, 2026

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

Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
@evaline-ju evaline-ju changed the title feat: Trace feat: Trace weather agent to MCP gateway tool calls Mar 3, 2026
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@mrsabath mrsabath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@evaline-ju evaline-ju marked this pull request as ready for review April 1, 2026 19:24
@evaline-ju evaline-ju merged commit 1091806 into kagenti:main Apr 1, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Kagenti Issue Prioritization Apr 1, 2026
@evaline-ju evaline-ju deleted the weather-trace-langchain branch April 1, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants