Backfills trace injection test and migrates from request.params
to request.params._meta
#360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Before, trace IDs were encoded in the
request.params
object which co-mingled it with fields like tool arguments.This backfills an encoding test and moves it to
request.params._meta
which is used elsewhere and proposed as a convention due to prior art and also being a bit safer for ad-hoc implementation regardless of this implementation being careful.This also corrects logic to replace any existing key in the message however unlikely that might be.
How Has This Been Tested?
Backfilled a unit test
Breaking Changes
The choice to use request.params was released in https://github.com/modelcontextprotocol/csharp-sdk/releases/tag/v0.1.0-preview.9. This changes it to
request.params._meta
. This means that applications already releasing this will need to update both sides to have context propagation. Since this SDK is in pre-release, I didn't add logic to fall back to extract fromrequest.params
Types of changes
Checklist
Additional context
request.params
OpenTelemetry: context propagation and semconv update #262request.params._meta
for use in opentelemetry traces as well other metadata: Document request.params._meta convention modelcontextprotocol#414