Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions docs/developers/development/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,49 @@ These settings can be overridden by environment variables or CLI flags.
| `otlpMetricsEndpoint` | `QWEN_TELEMETRY_OTLP_METRICS_ENDPOINT` | - | Per-signal endpoint override for metrics (HTTP only) | URL string | - |
| `outfile` | `QWEN_TELEMETRY_OUTFILE` | `--telemetry-outfile <path>` | Save telemetry to file (overrides OTLP export) | file path | - |
| `logPrompts` | `QWEN_TELEMETRY_LOG_PROMPTS` | `--telemetry-log-prompts` / `--no-telemetry-log-prompts` | Include prompts in telemetry logs | `true`/`false` | `true` |
| `includeSensitiveSpanAttributes` | `QWEN_TELEMETRY_INCLUDE_SENSITIVE_SPAN_ATTRIBUTES` | - | Include sensitive attributes in log-to-span bridge spans | `true`/`false` | `false` |
| `includeSensitiveSpanAttributes` | `QWEN_TELEMETRY_INCLUDE_SENSITIVE_SPAN_ATTRIBUTES` | - | Include user prompts, system prompts, tool I/O, and model output as native span attributes (in addition to log-to-span bridge spans) | `true`/`false` | `false` |

**Note on boolean environment variables:** For the boolean settings (`enabled`,
`logPrompts`, `includeSensitiveSpanAttributes`), setting the
corresponding environment variable to `true` or `1` will enable the feature. Any
other value will disable it.

**Sensitive log-to-span attributes:** When Qwen Code exports HTTP traces but has
no logs endpoint, log records are bridged into trace spans. By default, the
bridge drops `prompt`, `function_args`, and `response_text` from span attributes.
Set `includeSensitiveSpanAttributes` to `true` only when you explicitly want
those fields in bridged spans. This setting only controls the log-to-span
bridge. It does not disable sensitive data in OTel logs or other telemetry
sinks; non-internal API response telemetry can populate `response_text`, so OTel
logs, UI telemetry, and chat recording may receive response text independently
of this bridge setting. QwenLogger does not include `response_text`.
**Sensitive span attributes:** When `includeSensitiveSpanAttributes` is enabled,
two things happen:

1. **Native span attributes (`qwen-code.interaction`, `api.generateContent*`,
`tool.<name>`)** carry verbatim conversation content:
- User prompts (`new_context`)
- System prompts (`system_prompt` — full text once per session, deduped by
SHA-256 hash; subsequent spans only carry `system_prompt_hash` +
`system_prompt_preview` + `system_prompt_length`)
- Tool schemas (emitted as `tool_schema` events, also hash-deduped)
- Tool inputs (`tool_input`) and tool results (`tool_result`)
- Model output (`response.model_output`)

Each value is truncated at 60 KB; `*_truncated` and `*_original_length`
flags surface when truncation occurs.

2. **Log-to-span bridge spans** (used when HTTP traces are exported without a
logs endpoint) keep their existing `prompt`, `function_args`, and
`response_text` fields, instead of being dropped.

⚠️ **Security warning:** enabling this flag streams full conversation history,
file contents read by `read_file`, shell commands and their output (including
secrets in env vars or arguments), and model responses to the configured OTLP
backend. Treat the backend as a privileged data sink. The flag defaults to
`false`.

**Cost / payload size:** A heavy turn (60 KB system prompt + 10 tool calls,
each up to 60 KB input + 60 KB result, plus 60 KB model output) can produce up
to ~1.5 MB of attribute payload before OTLP compression. When pointing tools
that read large files (`read_file`, etc.) at long-running sessions, monitor
exporter throughput.

This setting does not disable sensitive data in OTel logs or other telemetry
sinks; non-internal API response telemetry can populate `response_text`, so
OTel logs, UI telemetry, and chat recording may receive response text
independently of this setting. QwenLogger does not include `response_text`.

**HTTP OTLP signal routing:** When using HTTP protocol (`otlpProtocol: "http"`),
Qwen Code automatically appends signal-specific paths (`/v1/traces`, `/v1/logs`,
Expand Down
20 changes: 10 additions & 10 deletions docs/users/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,15 @@ Configures connections to one or more Model-Context Protocol (MCP) servers for d

Configures logging and metrics collection for Qwen Code. For more information, see [telemetry](/developers/development/telemetry).

| Setting | Type | Description | Default |
| ------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `telemetry.enabled` | boolean | Whether or not telemetry is enabled. | |
| `telemetry.target` | string | Informational label for the telemetry destination (`local` or `gcp`). Does not control exporter routing; set `telemetry.otlpEndpoint` or `telemetry.outfile` to configure where data is sent. | |
| `telemetry.otlpEndpoint` | string | The endpoint for the OTLP Exporter. | |
| `telemetry.otlpProtocol` | string | The protocol for the OTLP Exporter (`grpc` or `http`). | |
| `telemetry.logPrompts` | boolean | Whether or not to include the content of user prompts in the logs. | |
| `telemetry.includeSensitiveSpanAttributes` | boolean | Whether to include `prompt`, `function_args`, and `response_text` in spans created by the log-to-span bridge. Only controls bridge spans; OTel logs and other telemetry sinks may still receive `response_text`. | `false` |
| `telemetry.outfile` | string | Path to write telemetry to a file. When set, overrides OTLP export. | |
| Setting | Type | Description | Default |
| ------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `telemetry.enabled` | boolean | Whether or not telemetry is enabled. | |
| `telemetry.target` | string | Informational label for the telemetry destination (`local` or `gcp`). Does not control exporter routing; set `telemetry.otlpEndpoint` or `telemetry.outfile` to configure where data is sent. | |
| `telemetry.otlpEndpoint` | string | The endpoint for the OTLP Exporter. | |
| `telemetry.otlpProtocol` | string | The protocol for the OTLP Exporter (`grpc` or `http`). | |
| `telemetry.logPrompts` | boolean | Whether or not to include the content of user prompts in the logs. | |
| `telemetry.includeSensitiveSpanAttributes` | boolean | When enabled, attaches verbatim user prompts, system prompts, tool inputs/outputs, and model responses to native OTel span attributes (in addition to log-to-span bridge spans). ⚠️ Streams sensitive data — file contents, shell commands, conversation history — to your OTLP backend. | `false` |
| `telemetry.outfile` | string | Path to write telemetry to a file. When set, overrides OTLP export. | |

### Example `settings.json`

Expand Down Expand Up @@ -576,7 +576,7 @@ For authentication-related variables (like `OPENAI_*`) and the recommended `.qwe
| `QWEN_TELEMETRY_OTLP_ENDPOINT` | Sets the OTLP endpoint for telemetry. | Overrides the `telemetry.otlpEndpoint` setting. |
| `QWEN_TELEMETRY_OTLP_PROTOCOL` | Sets the OTLP protocol (`grpc` or `http`). | Overrides the `telemetry.otlpProtocol` setting. |
| `QWEN_TELEMETRY_LOG_PROMPTS` | Set to `true` or `1` to enable or disable logging of user prompts. Any other value is treated as disabling it. | Overrides the `telemetry.logPrompts` setting. |
| `QWEN_TELEMETRY_INCLUDE_SENSITIVE_SPAN_ATTRIBUTES` | Set to `true` or `1` to include `prompt`, `function_args`, and `response_text` in spans created by the log-to-span bridge. Any other value disables it. | Overrides the `telemetry.includeSensitiveSpanAttributes` setting. Only controls bridge spans; OTel logs and other telemetry sinks may still receive `response_text`. |
| `QWEN_TELEMETRY_INCLUDE_SENSITIVE_SPAN_ATTRIBUTES` | Set to `true` or `1` to attach verbatim user prompts, system prompts, tool I/O, and model responses to native OTel span attributes (and keep `prompt` / `function_args` / `response_text` on log-to-span bridge spans). Any other value disables it. | Overrides the `telemetry.includeSensitiveSpanAttributes` setting. ⚠️ Streams sensitive data to your OTLP backend. |
| `QWEN_TELEMETRY_OUTFILE` | Sets the file path to write telemetry to. When set, overrides OTLP export. | Overrides the `telemetry.outfile` setting. |
| `QWEN_SANDBOX` | Alternative to the `sandbox` setting in `settings.json`. | Accepts `true`, `false`, `docker`, `podman`, or a custom command string. |
| `QWEN_SANDBOX_IMAGE` | Overrides sandbox image selection for Docker/Podman. | Takes precedence over `tools.sandboxImage`. |
Expand Down
25 changes: 13 additions & 12 deletions packages/cli/src/config/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = {
type: 'string',
description:
'The type of hook. Note: "function" type is only available via SDK registration, not settings.json.',
enum: ['command', 'http', 'prompt'],
enum: ['command', 'http'],
required: true,
},
command: {
Expand All @@ -198,16 +198,6 @@ const HOOK_DEFINITION_ITEMS: SettingItemDefinition = {
description:
'The URL to send the POST request to. Required for "http" type.',
},
prompt: {
type: 'string',
description:
'The prompt template to send to the LLM. Required for "prompt" type. Use $ARGUMENTS as placeholder for hook input JSON.',
},
model: {
type: 'string',
description:
'Optional model override for "prompt" type hooks. Defaults to your current model.',
},
headers: {
type: 'object',
description:
Expand Down Expand Up @@ -490,6 +480,17 @@ const SETTINGS_SCHEMA = {
'or set a specific language.',
showInDialog: true,
},
dynamicCommandTranslation: {
type: 'boolean',
label: 'Language: Dynamic Command Translation',
category: 'General',
requiresRestart: false,
default: false,
description:
'Enable AI translation for dynamic slash command descriptions. ' +
'When disabled, dynamic commands use their original descriptions and do not trigger translation model calls.',
showInDialog: true,
},
terminalBell: {
type: 'boolean',
label: 'Terminal Bell Notification',
Expand Down Expand Up @@ -975,7 +976,7 @@ const SETTINGS_SCHEMA = {
properties: {
includeSensitiveSpanAttributes: {
description:
'Include prompt, function_args, and response_text in spans created by the log-to-span bridge. Only controls bridge spans; OTel logs and other telemetry sinks may still receive response_text.',
'When enabled, user prompts, system prompts, tool inputs/outputs, and model responses are written to native OTel span attributes in addition to the log-to-span bridge. Warning: this may expose sensitive data (file contents, shell commands, conversation history) to your OTLP backend.',
type: 'boolean',
default: false,
},
Expand Down
Loading
Loading