# 1. Enable telemetryexport CODEBUDDY_CODE_ENABLE_TELEMETRY=1# 2. Configure the OTLP endpointexport OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318# 3. (Optional) Enable privacy opt-in content recordingexport OTEL_LOG_USER_PROMPTS=1export OTEL_LOG_TOOL_DETAILS=1export OTEL_LOG_TOOL_CONTENT=1# 4. Runcodebuddy
CLAUDE_CODE_ENABLE_TELEMETRY is equivalent to CODEBUDDY_CODE_ENABLE_TELEMETRY.Variable | Purpose | Example |
CODEBUDDY_CODE_ENABLE_TELEMETRY | Enable OTel reporting (required). | 1 |
OTEL_TRACES_EXPORTER | Exporter type | otlp (default), console, none |
OTEL_EXPORTER_OTLP_ENDPOINT | OTLP Collector address, with /v1/traces automatically appended. | http://localhost:4318 |
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | Dedicated full URL for Traces, with higher priority. | http://localhost:4318/v1/traces |
OTEL_EXPORTER_OTLP_HEADERS | Request headers k1=v1,k2=v2, with URL encoding supported for values. | Authorization=Bearer%20token |
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL | Transport protocol | http/protobuf (only supported) |
OTEL_SERVICE_NAME | Override the default service.name | codebuddy-code |
OTEL_RESOURCE_ATTRIBUTES | Attach resource attributes. | team=platform,env=prod |
Variable | Purpose | Recorded Content |
OTEL_LOG_USER_PROMPTS=1 | Record user prompts. | user_prompt attribute (not recorded by default; only user_prompt_length is recorded). |
OTEL_LOG_TOOL_DETAILS=1 | Record tool parameters. | tool_input attribute (truncated at ~4 KB) + tool-specific attributes (file.path, command, and others) |
OTEL_LOG_TOOL_CONTENT=1 | Record full tool input and output. | tool_input/tool_result span events (truncated at 60 KB) |
OTEL_LOG_RAW_API_BODIES=1 | Record full API request/response bodies. | Reserved, not yet implemented |
codebuddy_code.* spans and span.type). To integrate with agentLens (Tencent Zhiyan LLM monitoring, based on OTel), append the gen_ai.* semantic convention fields through OTEL_SEMCONV (additive only, preserving all original fields):Value | Description |
codebuddy (default) | No new fields are written, and the behavior is exactly the same as the current state. |
agentlens | Enable agentLens semantics and append fields such as gen_ai.*. |
input.value / output.value) are produced along with this toggle, so you do not need to additionally enable OTEL_LOG_RAW_API_BODIES. However, the user prompt and final response text of entry spans are still gated by OTEL_LOG_USER_PROMPTS, and their content is not recorded when this toggle is disabled.gen_ai.usage.*) depends on whether the upstream returns usage. If usage is not returned, the LLM span lacks the token field, while other fields remain unchanged. To obtain tokens reliably, include include_usage in your business-side requests.span Type ( span.type) | gen_ai.span.kind | Key Field |
interaction (entry) | AGENT | gen_ai.user.time_to_first_token,input.value / output.value |
subagent (nested) | AGENT | gen_ai.operation.name |
model_stream (LLM call) | LLM | gen_ai.system / model_name / request.model / request.parameters / response.time_to_first_token / response.finish_reason / usage.input_tokens / usage.output_tokens / usage.total_tokens / input.value / output.value |
tool / user_input_wait | TOOL | tool.name / tool.parameters / input.value / output.value |
mcp_call | TOOL | tool.name / gen_ai.mcp.server_name / gen_ai.mcp.tool_name |
context_compact / session_replay / teammate_busy | TASK | — |
model_request | (Not reported) | See the description below. |
gen_ai.session.id / gen_ai.user.id / gen_ai.framework / gen_ai.business.scenario (omitted by default).input.value / output.value / tool.name / tool.parameters follow the OpenInference convention and do not have the gen_ai. prefix, while gen_ai.system / gen_ai.model_name / gen_ai.mcp.* and similar fields do have the prefix.model_request is not reported: it is an auxiliary HTTP request span for model calls and appears in pairs with model_stream, which carries the inference. Reporting both simultaneously causes duplicate counting of LLM call counts, tokens, and TTFT. Therefore, this span is not reported under agentlens. By default, the codebuddy trace remains fully intact for local troubleshooting.codebuddy_code.interaction. Tool call records are its child spans:codebuddy_code.interaction├── codebuddy_code.tool (Read)├── codebuddy_code.tool (Bash)└── codebuddy_code.tool (Agent -> tool spans of sub-agents)
span.type attribute to identify their type.codebuddy_code.interactionAttribute | Description | Controlled By |
span.type | Fixed value "interaction" | - |
conversation.id | Conversation ID | - |
conversation.agent | Agent name | - |
user_prompt | User prompt content (not recorded when the feature is disabled) | OTEL_LOG_USER_PROMPTS |
user_prompt_length | Prompt length (always recorded) | - |
conversation.cancelled | true when the conversation is canceled. | - |
codebuddy_code.toolAttribute | Description | Controlled By |
span.type | Fixed value "tool" | - |
tool_name | Tool Name | - |
tool.call_id | Tool Call ID (Always Recorded) | - |
file.path | File path (Read/Write/Edit) | OTEL_LOG_TOOL_DETAILS |
command | Bash Command | OTEL_LOG_TOOL_DETAILS |
command.timeout | Command timeout in milliseconds | OTEL_LOG_TOOL_DETAILS |
glob.pattern | Glob search pattern | OTEL_LOG_TOOL_DETAILS |
grep.pattern | Grep regular expression pattern | OTEL_LOG_TOOL_DETAILS |
http.url | WebFetch URL | OTEL_LOG_TOOL_DETAILS |
search.query | WebSearch query | OTEL_LOG_TOOL_DETAILS |
agent.prompt | Sub-Agent prompt | OTEL_LOG_TOOL_DETAILS |
agent.type | Sub-Agent type | OTEL_LOG_TOOL_DETAILS |
mcp.server | MCP server name | OTEL_LOG_TOOL_DETAILS |
mcp.tool | MCP tool name | OTEL_LOG_TOOL_DETAILS |
tool_input | Tool input JSON, truncated at approximately 4 KB | OTEL_LOG_TOOL_DETAILS |
tool_input_truncated | Whether the input is truncated | OTEL_LOG_TOOL_DETAILS |
tool_input_original_length | Original length before truncation | OTEL_LOG_TOOL_DETAILS |
codebuddy_code.tool span events (requires OTEL_LOG_TOOL_CONTENT=1)Event name | Attribute | Description |
tool_input | content | Complete tool input, truncated at 60 KB |
tool_input | content_truncated | Truncated or Not |
tool_input | content_original_length | Length before truncation |
tool_result | content | Complete tool output, truncated at 60 KB |
tool_result | content_truncated | Truncated or Not |
tool_result | content_original_length | Length before truncation |
export CODEBUDDY_CODE_ENABLE_TELEMETRY=1export OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.corp.example.comexport OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20<TOKEN>export OTEL_SERVICE_NAME=codebuddy-codeexport OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,team=copilot
export CODEBUDDY_CODE_ENABLE_TELEMETRY=1export OTEL_TRACES_EXPORTER=consoleexport OTEL_LOG_USER_PROMPTS=1export OTEL_LOG_TOOL_DETAILS=1export OTEL_LOG_TOOL_CONTENT=1
export OTEL_TRACES_EXPORTER=none# Or disable globally:export DISABLE_TELEMETRY=1
DISABLE_TELEMETRY=1 has the highest priority and disables all telemetry.CODEBUDDY_CODE_ENABLE_TELEMETRY / CLAUDE_CODE_ENABLE_TELEMETRY is set to a truthy value (1 / true / yes / on).OTEL_EXPORTER_OTLP_TRACES_ENDPOINT > OTEL_EXPORTER_OTLP_ENDPOINT > telemetry.tracing.url in the built-in product configuration.http/protobuf (OTLP/HTTP + Protobuf encoding) is supported, which is consistent with the Claude Code default. Setting OTEL_EXPORTER_OTLP_PROTOCOL=grpc or http/json is ignored and written to the alarm log, falling back to the default protobuf.user_prompt_length is always recorded (length only), while the prompt text is written only when OTEL_LOG_USER_PROMPTS=1 is set.OTEL_LOG_TOOL_DETAILS=1. Individual values exceeding 512 characters are truncated, and the total size is limited to approximately 4 KB.OTEL_LOG_TOOL_CONTENT=1. It is recorded through span events and truncated at 60 KB.telemetry.report.standard) are two independent channels and can be enabled at the same time.{product}.interaction / {product}.tool), ensuring that upstream analysis platforms can process them uniformly.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback