Skip to content

OpenTelemetry inject trace context propagation in _meta - #2093

Closed
aabmass wants to merge 1 commit into
modelcontextprotocol:mainfrom
aabmass:otel-propagation
Closed

OpenTelemetry inject trace context propagation in _meta#2093
aabmass wants to merge 1 commit into
modelcontextprotocol:mainfrom
aabmass:otel-propagation

Conversation

@aabmass

@aabmassaabmass commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Part of #421

Motivation and Context

This implements OpenTelemetry context forward propagation (if available) through _meta, as specified in

MCP C# SDK has a similar implementation: https://github.com/modelcontextprotocol/csharp-sdk/blob/v0.8.0-preview.1/src/ModelContextProtocol.Core/Diagnostics.cs#L64. This is working for normal client to server calls, and for server calls back to the client like MCP Sampling.

How Has This Been Tested?

Added new test cases

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Extracting the context from _meta into OTel context in the receiving side is the next PR (#2133), but depends on merging #1996

@aabmass
aabmassforce-pushed the otel-propagation branch 2 times, most recently from 7898dc4 to 730ce42CompareFebruary 18, 2026 21:20
@aabmass
aabmass marked this pull request as ready for review February 18, 2026 21:26
@aabmassaabmass changed the title OpenTelemetry _meta propagationOpenTelemetry trace context propagation in _metaFeb 18, 2026
@aabmass
aabmassforce-pushed the otel-propagation branch 2 times, most recently from a694ffb to b6b0647CompareFebruary 24, 2026 06:22
@aabmassaabmass changed the title OpenTelemetry trace context propagation in _metaOpenTelemetry inject trace context propagation in _metaFeb 24, 2026
@aabmass
aabmassforce-pushed the otel-propagation branch 3 times, most recently from b66d2e0 to c410d7bCompareMarch 2, 2026 16:45
@maxisbeymaxisbey added enhancement Request for a new feature that's not currently supported v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes P3 Nice to haves, rare edge cases labels Mar 5, 2026
@maxisbey

Copy link
Copy Markdown
Contributor

Thanks for the PR. This has since landed via #2381. Closing as part of a general backlog cleanup following the v2 release. If this is still relevant against v2, feel free to reopen.

AI Disclaimer

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementRequest for a new feature that's not currently supportedP3Nice to haves, rare edge casesv2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@aabmass@maxisbey