diff --git a/docs/developers/development/telemetry.md b/docs/developers/development/telemetry.md index b826d0472f..266ce05cc8 100644 --- a/docs/developers/development/telemetry.md +++ b/docs/developers/development/telemetry.md @@ -327,6 +327,24 @@ for cross-process trace stitching — e.g. ARMS Tracing serving DashScope. For most operators the value is `false`; cross-vendor trace continuation is niche. +**Depends on `telemetry.enabled: true`.** The OTel SDK only initializes +when telemetry is enabled, so `propagateTraceContext` only takes effect +in that state. Setting it to `true` while telemetry is disabled is a +silent no-op — no SDK, no propagator, no `traceparent` on the wire. +Verify both flags when wiring an ARMS+DashScope correlation setup: + +```jsonc +{ + "telemetry": { + "enabled": true, + "otlpTracesEndpoint": "http://tracing-analysis-...", + }, + "outboundCorrelation": { + "propagateTraceContext": true, + }, +} +``` + ### Other outbound correlation headers `X-Qwen-Code-Session-Id` and `X-Qwen-Code-Request-Id` are **not part of diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 161c4afe5d..a611f091fe 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -1052,7 +1052,7 @@ const SETTINGS_SCHEMA = { properties: { propagateTraceContext: { description: - "Inject W3C `traceparent` header on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...). Default: false — trace context stays internal to the operator's OTLP collector and is NOT written onto third-party request streams. Set true only when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope). Note: client HTTP spans are still emitted in either case; this flag only governs the wire `traceparent` header.", + "Inject W3C `traceparent` header on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...). Default: false — trace context stays internal to the operator's OTLP collector and is NOT written onto third-party request streams. Set true only when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope). Note: client HTTP spans are still emitted in either case; this flag only governs the wire `traceparent` header. Depends on `telemetry.enabled: true` — the OTel SDK only initializes when telemetry is enabled, so this flag is a silent no-op without it.", type: 'boolean', default: false, }, diff --git a/packages/core/src/telemetry/sdk.test.ts b/packages/core/src/telemetry/sdk.test.ts index dc3155fe5e..91a0a35532 100644 --- a/packages/core/src/telemetry/sdk.test.ts +++ b/packages/core/src/telemetry/sdk.test.ts @@ -677,9 +677,10 @@ describe('Telemetry SDK', () => { ).mockReturnValue(true); initializeTelemetry(mockConfig); // textMapPropagator is omitted from NodeSDK options → SDK installs - // its default W3C composite propagator. Test asserts the absence - // because the actual W3CTraceContextPropagator instance is created - // inside @opentelemetry/sdk-node which is auto-mocked here. + // its default `CompositePropagator` (W3CTraceContextPropagator + + // W3CBaggagePropagator). Test asserts the absence at the constructor + // boundary because the default composite is constructed inside + // @opentelemetry/sdk-node, which is auto-mocked here. expect(getTextMapPropagator()).toBeUndefined(); }); }); diff --git a/packages/vscode-ide-companion/schemas/settings.schema.json b/packages/vscode-ide-companion/schemas/settings.schema.json index c86fb1b4ed..5604d7bdba 100644 --- a/packages/vscode-ide-companion/schemas/settings.schema.json +++ b/packages/vscode-ide-companion/schemas/settings.schema.json @@ -444,7 +444,7 @@ "type": "object", "properties": { "propagateTraceContext": { - "description": "Inject W3C `traceparent` header on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...). Default: false — trace context stays internal to the operator's OTLP collector and is NOT written onto third-party request streams. Set true only when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope). Note: client HTTP spans are still emitted in either case; this flag only governs the wire `traceparent` header.", + "description": "Inject W3C `traceparent` header on outbound `fetch` requests (LLM SDK calls, MCP StreamableHTTP, WebFetch, ...). Default: false — trace context stays internal to the operator's OTLP collector and is NOT written onto third-party request streams. Set true only when you want cross-process trace stitching with an OTel-aware LLM provider (e.g. ARMS+DashScope). Note: client HTTP spans are still emitted in either case; this flag only governs the wire `traceparent` header. Depends on `telemetry.enabled: true` — the OTel SDK only initializes when telemetry is enabled, so this flag is a silent no-op without it.", "type": "boolean", "default": false }