diff --git a/examples/tracing/README.md b/examples/tracing/README.md index f30ca64..4156677 100644 --- a/examples/tracing/README.md +++ b/examples/tracing/README.md @@ -2,8 +2,9 @@ End-to-end OpenTelemetry: every envelope on the wire (in either direction) emits a span, and W3C trace context (`traceparent` / -`tracestate`) rides along inside `envelope.extensions["x.otel"]` so -the spans link into one distributed trace. +`tracestate`) rides along inside +`envelope.extensions["x-vendor.opentelemetry.tracecontext"]` so the +spans link into one distributed trace. The middleware MUST be wired on **both** sides. If only one side wires it, that side's spans are correct in isolation, but the peer creates @@ -70,5 +71,6 @@ Tempo, Honeycomb, or any OTLP receiver. ## Spec sections -- §11 Trace propagation (W3C context via `extensions["x.otel"]`) +- §11 Trace propagation (W3C context via + `extensions["x-vendor.opentelemetry.tracecontext"]`) - §10.3 trace inheritance on delegation diff --git a/examples/tracing/client.ts b/examples/tracing/client.ts index e0b6d22..040b87e 100644 --- a/examples/tracing/client.ts +++ b/examples/tracing/client.ts @@ -3,7 +3,7 @@ * * Wires `@agentruntimecontrolprotocol/middleware-otel` into the client transport so spans on * the submit path link end-to-end with the server's spans via W3C trace - * context carried in `extensions["x.otel"]`. + * context carried in `extensions["x-vendor.opentelemetry.tracecontext"]`. * * Run after `server.ts`: * pnpm tsx examples/tracing/client.ts diff --git a/examples/tracing/server.ts b/examples/tracing/server.ts index 226f6a9..c2a4d2e 100644 --- a/examples/tracing/server.ts +++ b/examples/tracing/server.ts @@ -2,9 +2,10 @@ * Tracing example — server. * * Wires `@agentruntimecontrolprotocol/middleware-otel` into the runtime side so every inbound - * frame extracts the W3C trace context from `extensions["x.otel"]` and - * every outbound frame injects one. Spans are exported to the console - * via `ConsoleSpanExporter` — no collector required. + * frame extracts the W3C trace context from + * `extensions["x-vendor.opentelemetry.tracecontext"]` and every outbound + * frame injects one. Spans are exported to the console via + * `ConsoleSpanExporter` — no collector required. */ import { diff --git a/packages/middleware/otel/src/index.ts b/packages/middleware/otel/src/index.ts index 3ddf541..d9a7dd8 100644 --- a/packages/middleware/otel/src/index.ts +++ b/packages/middleware/otel/src/index.ts @@ -6,11 +6,13 @@ * * - Outbound `send` calls produce a `arcp.send` span with the envelope * type/id/session_id as attributes, and the active trace context is - * injected into the envelope's `extensions["x.otel"]` field (W3C - * traceparent + tracestate) so the peer can continue the trace. + * injected into the envelope's + * `extensions["x-vendor.opentelemetry.tracecontext"]` field (W3C + * `traceparent` + `tracestate`) so the peer can continue the trace. * - Inbound frames produce a `arcp.recv` span, extracting any - * `extensions["x.otel"]` trace context so the inbound frame appears - * as a child of the originating span on the remote end. + * `extensions["x-vendor.opentelemetry.tracecontext"]` trace context so + * the inbound frame appears as a child of the originating span on the + * remote end. * * Wire it on either side: * ```ts @@ -50,7 +52,8 @@ const OTEL_EXTENSION_NAME = "x-vendor.opentelemetry.tracecontext" as const; /** * Wrap a {@link Transport} so each frame produces a span and W3C trace - * context is propagated through `envelope.extensions["x.otel"]`. + * context is propagated through + * `envelope.extensions["x-vendor.opentelemetry.tracecontext"]`. * * The returned transport satisfies the same interface, so it is a drop-in * for `ARCPServer.accept(...)` / `ARCPClient.connect(...)`.