Qwen Code OpenTelemetry
A practical guide to Qwen Code telemetry: available metrics, logs and traces, configuration, privacy considerations, and what engineering teams can learn from the data.
Updated September 2026 · 12 min read
Qwen Code
AI coding agent
OpenTelemetry
Instrumentation
Signals
- Metrics
- Logs
- Traces
Compatible backend
Your observability stack
Quick answer
What is Qwen Code OpenTelemetry?
Qwen Code includes OpenTelemetry support for collecting and exporting observability data about AI-assisted development. Its telemetry can provide visibility into sessions, model usage, token consumption, tool calls, latency, errors and MCP activity.
Qwen Code supports standard OpenTelemetry signals and OTLP export, allowing organizations to send telemetry to compatible observability infrastructure.
In short: OpenTelemetry makes Qwen Code activity observable across AI models, tools and development workflows.
Telemetry signals
What Telemetry Does Qwen Code Provide?
Qwen Code uses OpenTelemetry to provide metrics, logs and traces covering usage, performance and agent activity.
- Available
Metrics
Quantitative measurements covering usage, tokens, performance and supported development activity. Metric names use the qwen-code.* prefix.
- Available
Logs
Structured events describing Qwen Code sessions, model interactions, tools and other supported activity, each carrying event.name and event.timestamp.
- Available
Traces
Distributed traces providing visibility into operations across AI-assisted workflows, rooted at the qwen-code.interaction span.
Telemetry reference
What Data Can Qwen Code Export?
Qwen Code telemetry covers multiple dimensions of AI coding activity, from model consumption to tools and MCP interactions. Identifiers below come from the official Qwen Code telemetry documentation.
| Data category | Signal | Official identifier | What it helps observe |
|---|---|---|---|
| Sessions | Metric · Log | qwen-code.session.count | Qwen Code usage and session activityIncremented once per CLI startup. The session.start and session.end log events carry the session.id attribute. |
| Models | Log · Span | qwen-code.api_request | Models involved in AI-assisted workflowsLog events carry the model attribute; the qwen-code.llm_request span carries gen_ai.request.model and gen_ai.response.model. |
| Token usage | Metric | qwen-code.token.usage | AI token consumptionCounter with model and type attributes (input, output, thought, cache). Spans also expose gen_ai.usage.input_tokens and gen_ai.usage.output_tokens. |
| Tool calls | Metric · Log | qwen-code.tool.call.count | Tools invoked during agent workflowsAttributes include function_name, status, decision and tool_type. The qwen-code.tool_call log event records each call in detail. |
| Latency | Metric | qwen-code.api.request.latency | Execution and model-response performanceHistogram in milliseconds by model. qwen-code.tool.call.latency records tool call latency by function_name. |
| Errors | Log · Metric | qwen-code.api_error | Errors and failed operationsCarries model, duration_ms, error_message and error_type. Retry counters such as qwen-code.api.retry.count cover 429/5xx retries. |
| MCP | Attribute | tool_type="mcp" | Activity involving Model Context Protocol integrationsTool telemetry distinguishes native from MCP tools via tool_type, with mcp_server_name on the qwen-code.tool_call log event. The startup qwen-code.config event reports mcp_servers and mcp_tools counts. |
| Agent activity | Span | qwen-code.interaction | Supported AI-agent operations and workflowsRoot span for one logical prompt, with gen_ai.operation.name=invoke_agent and gen_ai.agent.name=qwen-code. Subagents are counted by qwen-code.subagent.execution.count. |
Common attributes
session.idSession key shared across spans and log events; opt-in on metrics.
prompt_idCorrelates log events belonging to the same prompt.
gen_ai.conversation.idConversation identifier on GenAI request spans.
gen_ai.operation.nameinvoke_agent on interaction spans, execute_tool on tool spans.
tool_typenative or mcp on tool call telemetry.
mcp_server_nameOptional MCP server name on the qwen-code.tool_call event.
modelModel involved in the API request, response or token usage.
OTEL_RESOURCE_ATTRIBUTESStatic resource attributes attached to every exported span, log and metric.
Use cases
What Can Engineering Teams Learn From Qwen Code Telemetry?
Qwen Code telemetry can help engineering organizations answer questions about adoption, AI consumption, tools, MCP integrations and reliability.
Adoption & Usage
Understand how Qwen Code usage evolves across an engineering organization by analyzing sessions and activity over time.
AI Consumption
Analyze model and token consumption to understand how AI resources are used across development workflows.
Tools & MCP
Understand how Qwen Code interacts with tools and Model Context Protocol integrations during agent workflows.
Performance & Reliability
Use latency and error telemetry to investigate the performance and reliability of AI-assisted workflows.
Usage and activity metrics provide context about AI-assisted development. They should not be treated as standalone measures of developer productivity.
How it works
How Qwen Code OpenTelemetry Works
Qwen Code generates OpenTelemetry telemetry that can be exported through OTLP to compatible observability infrastructure.
Qwen Code
OpenTelemetry
- Metrics
- Logs
- Traces
OTLP
gRPC or HTTP
Collector or compatible backend
Configuration
How to Enable OpenTelemetry in Qwen Code
Qwen Code telemetry can be configured to export supported signals through OpenTelemetry-compatible infrastructure. All telemetry behavior is controlled through the .qwen/settings.json file, and can be overridden by environment variables or CLI flags.
// .qwen/settings.json
{
"telemetry": {
"enabled": true,
"otlpEndpoint": "https://<your-otlp-endpoint>",
"otlpProtocol": "grpc"
}
}
# Environment-variable equivalents
export QWEN_TELEMETRY_ENABLED=true
export QWEN_TELEMETRY_OTLP_ENDPOINT="https://<your-otlp-endpoint>"
export QWEN_TELEMETRY_OTLP_PROTOCOL=grpcView advanced configuration
otlpProtocol— grpc or http, defaulting to grpc. The default endpoint is http://localhost:4317.Per-signal endpoints— otlpTracesEndpoint, otlpLogsEndpoint and otlpMetricsEndpoint (HTTP only) override the endpoint for a single signal — useful for backends with non-standard paths.outfile— QWEN_TELEMETRY_OUTFILE writes telemetry to a local file and overrides OTLP export, which is convenient for local inspection.logPrompts— QWEN_TELEMETRY_LOG_PROMPTS controls whether prompt content and API request/response text are included in telemetry logs. Default: true.includeSensitiveSpanAttributes— Off by default. When enabled, spans carry GenAI messages, system instructions, tool definitions, tool arguments and successful tool results, bounded by sensitiveSpanAttributeMaxLength.metrics.includeSessionId— Disabled by default to protect metric backends from time-series fan-out. Spans and logs still carry session.id for per-session analysis.resourceAttributes— Set via the telemetry.resourceAttributes setting or OTEL_RESOURCE_ATTRIBUTES / OTEL_SERVICE_NAME to tag every exported signal, for example deployment.environment=production.CLI flags— --telemetry / --no-telemetry, --telemetry-otlp-endpoint, --telemetry-otlp-protocol and --telemetry-outfile override settings at launch.
The full settings table is documented in Qwen Code's telemetry reference.
Privacy
Privacy and Sensitive Data
AI coding telemetry can contain detailed information about developer interactions, models and agent workflows. Organizations should understand which data is exported before enabling telemetry at scale.
Prompts & Content
Qwen Code documents a logPrompts setting (QWEN_TELEMETRY_LOG_PROMPTS) that includes user prompt content and API request/response text in telemetry logs; it defaults to true, so teams that do not want content in telemetry should disable it. Sensitive GenAI span attributes such as input messages, system instructions and tool arguments are governed separately by includeSensitiveSpanAttributes, which defaults to false.
Tools & MCP
Tool and MCP telemetry can reveal details about agent workflows and external integrations and should be handled according to organizational policies. Tool call events record function names, arguments and MCP server names depending on configuration.
Telemetry Destination
OpenTelemetry allows organizations to send supported Qwen Code telemetry to compatible infrastructure under their control, through an OTLP endpoint, per-signal endpoints, or a local file via the outfile setting.
Good practice: Collect the minimum telemetry required for the questions your organization wants to answer.
From telemetry to analytics
OpenTelemetry Gives You the Data. What Do You Do With It?
Qwen Code provides detailed telemetry across models, tokens, tools, MCP integrations and performance. But raw telemetry does not automatically explain how AI-assisted development is evolving across an engineering organization.
These signals need to be structured and interpreted to understand broader patterns around adoption, AI consumption and agent workflows.
Turn Qwen Code Telemetry Into Engineering Intelligence
helloMetry transforms supported AI coding telemetry into structured analytics designed to help engineering organizations understand how AI is being adopted and used.
- Adoption
- AI Consumption
- Tools & MCP
- Agent Workflows
Overview
- Code38%
- Analysis24%
- Writing18%
- Research12%
- Other8%
- /code_review142 usages4.892
- /debug98 usages3.210
- /refactor85 usages2.761
- /data_analysis74 usages2.104
- /summarize68 usages1.874
Explore Other OpenTelemetry Integrations

Claude Code
Claude Code OpenTelemetry: metrics, events and traces, configuration and privacy considerations.
Read the guideGemini CLI
Gemini CLI OpenTelemetry: available metrics, logs and traces, setup and privacy considerations.
Read the guideGitHub Copilot
GitHub Copilot OpenTelemetry: agent metrics, events and traces, setup and privacy considerations.
Read the guideCursor
Cursor OpenTelemetry: exported metrics and logs, destination setup and privacy considerations.
Read the guide
FAQ
Frequently Asked Questions
Does Qwen Code support OpenTelemetry?
Yes. Qwen Code includes OpenTelemetry support for exporting supported metrics, logs and traces to compatible observability infrastructure.
What can Qwen Code telemetry measure?
Qwen Code telemetry can provide visibility into sessions, models, token consumption, tools, latency, errors, MCP activity and supported agent workflows.
Does Qwen Code support OpenTelemetry traces?
Yes. Qwen Code supports distributed tracing as part of its OpenTelemetry observability capabilities.
Can Qwen Code token usage be monitored?
Yes. Qwen Code exposes supported telemetry related to model and token consumption.
Can Qwen Code MCP activity be observed?
Qwen Code telemetry provides supported observability data related to MCP activity, helping teams understand how Model Context Protocol integrations participate in agent workflows.
Does helloMetry replace OpenTelemetry?
No. OpenTelemetry provides the standard used to collect and export telemetry. helloMetry uses supported telemetry to transform AI coding-agent data into engineering analytics.
Sources & further reading
Primary technical source: official Qwen Code documentation
Qwen Code — TelemetryRepository reference
QwenLM/qwen-code — Observability with OpenTelemetry