-
Notifications
You must be signed in to change notification settings - Fork 116
docs(rfd): Draft: Meta Field Propagation Conventions #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(rfd): Draft: Meta Field Propagation Conventions #276
Conversation
|
Thanks, it makes lots of sense for better traces |
|
Should those "reserved" keys under meta be part of the actual spec payload (it does not have to be at the root). In most message-passing system I worked on the need for Otherwise, too much disciplined and keep up with things is required. Or future considerations needs that weren't cover, and now people did it their way and the spec can not simply break so many users without backslash. |
|
@yordis yeah your point about prefixes or dedicated namespace is totally reasonable. many systems do it that way even if otel norms typically use whatever the core metadata carrier is (e.g. inject directly into kafka headers). Some reasons to highlight from this change is that it is following a soft agreement that exists today, vs creating a new one. This is central to the otel propagation and maybe I wrote things in a way that triggered into thinking this must be applied for all future decisions.. that wasn't my intent. Mainly, I want to help carve out propagation notes that align with today. Here are the salient points on that:
One note: There's no practical way to enforce these reserved keys beyond documentation. The SDKs all type In other words, I'm hoping for a pragmatic evolution of How about this change to the RFD.. would it help to "soft reserve" the keys by documenting the core ones? e.g. revise Change 2 to explicitly reserve these keys: -**Change 2**: After the JSON example, before "Implementations **MUST NOT**", add this paragraph:
-
-> Clients may propagate fields to the agent for correlation purposes, such as `requestId`. [OpenTelemetry
SDKs](https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_propagators) default to propagating W3C `traceparent`, `tracestate`, and
`baggage` fields as root keys in `_meta`.
+**Change 2**: After the JSON example, before "Implementations **MUST NOT**", add:
+
+> Clients may propagate fields to the agent for correlation purposes, such as `requestId`. The following root-level keys in `_meta` are reserved for [W3C
trace context](https://www.w3.org/TR/trace-context/) to guarantee interop with existing MCP implementations and OpenTelemetry tooling:
+>
+> - `traceparent`
+> - `tracestate`
+> - `baggage`this doesn't prevent anyone from using namespaced prefixes for their own metadata if they prefer that pattern: it mainly protects the three keys that existing tooling already depends on. let me know if this works for you and i'll update the PR. |
|
At this point, the best we can do is a SHOULD in the spec anyway without necessitating a new version of the protocol. Obviously, as we get ready for v2, we should revisit all of the SHOULDs and see which should become MUSTs, but I also see some value today in providing some top-level telemetry/observability/pick your title guide for the protocol that if you want traces, this is how you can add them to your This will also allow us as an ecosystem to start implementing this and see what we might still be missing. We could add some top-level dedicated field for telemetry, outside of _meta, but I think starting by following the example from other protocols seems like a good first step to me. It also seems low-risk that these three keys happen to be used in any context outside of OTEL anyway... (maybe |
|
agree @benbrandt I'll switch the wording to SHOULD. Also, when we make the otel guide, this should link out to it for elaboration. agree on that, too |
Document `params._meta` as the convention for propagating metadata from clients to agents, such as trace identifiers or correlation IDs. This aligns with MCP, enabling shared instrumentation since both protocols use stdio JSON-RPC transports.
Reserves traceparent, tracestate, and baggage using SHOULD rather than MUST. Allows ecosystem adoption without a protocol version change while protecting keys existing tooling depends on.
6abe9aa to
1c907a8
Compare
|
ok rebased and I think this covers it. lemme know |
benbrandt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'm sure there will be some discussion about the final wording, but I've already updated the schema in #290 to match where this is going.
I guess part of the implementation may also be sketching some of this out in the SDKs as well to automate certain properties for the users, but we can figure this out as we go.
Merging to Draft stage 🎉
|
#297 to actually make the doc edit. I decided to leave the code comments and schema alone, unless you believe otherwise is needed. |
Document
params._metaas the convention for propagating metadata from clients to agents, such as trace identifiers or correlation IDs.This aligns with MCP, enabling shared instrumentation since both protocols use stdio JSON-RPC transports.