Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions develop-docs/sdk/expected-features/mcp-instrumentation/tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,17 @@ Describes MCP notification messages (one-way messages that don't expect a respon
- The `mcp.method.name` attribute MUST be set to the notification method. (e.g. `"notifications/cancelled"`)
- All [Common Span Attributes](#common-span-attributes) SHOULD be set (all `required` common attributes MUST be set).

## Distributed Tracing

Traces should be continued when a client makes a tool call request to an MCP server and both the client and server are instrumented. To do so, we inject both the trace parent (sentry-trace) and baggage into the `_meta` field of the request, and pick these up on the server. The tracing metadata attached in the `_meta` field is the same as the metadata contained in HTTP headers in HTTP-based trace continuation.

The SDK must respect any existing metadata in `_meta`. If previously empty, the `_meta` field must have the form

```json
"_meta": {
"sentry-trace": "...",
"baggage": "...",
}
```

where "sentry-trace" is analogous to the [`sentry-trace` HTTP header](/sdk/telemetry/traces/#header-sentry-trace) and "baggage" is analogous to [`baggage` HTTP header](/sdk/telemetry/traces/dynamic-sampling-context/#baggage-header).
Comment on lines +177 to +190
Copy link
Member

@cleptric cleptric Dec 10, 2025

Choose a reason for hiding this comment

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

Maybe we can already think about how we can support mixed OTLP/Sentry instrumentation here. As in, can we rely on the traceparent header instead of our sentry-tace header?
Also, which options should define if we perform propagation? tracePropagationTargets or something new?

Loading