-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
I would like to see Opentelemetry traces and Metrics baked into SDK.
E.g.
- Traces emitted on all Requests from client and server side of MCP SDK.
- Metrics for tool/prompt/resource calls
Describe the solution you'd like
I am trying to use Opentelemetry sdk to add traces and metrics features.
Steps
- Creating session in client and server.
- Initialise tracer (Opentelemetry tracer instances) in
BaseSession
(src/mcp/shared/session.py
). - Binding trace context (
traceparent
) to_meta
ofRequestParams.Meta
before sending request from client (send_request
insrc/mcp/shared/session.py
) - In server use the
traceparent
from received request to create new span with incoming span as parent span.
Describe alternatives you've considered
I tried to implement the same via traceloop. I was not able to get correct parent - child relationship between spans while doing so.
Additional context
I am able to achieve distributed tracing across my Agentic application and MCP server.

jhgaylor, wenxuwan, ronensc, pl4nty, gyliu513 and 4 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request