How to integrate Claude Code's telemetry with Phoenix? #11153
-
|
Hi, I saw the blog at https://arize.com/blog/claude-code-observability-and-tracing-introducing-dev-agent-lens/ which creates a LiteLLM proxy to allow exporting Claude Code's traces to Phoenix Arize. However, I also saw that Claude Code exports OTEL natively (see https://code.claude.com/docs/en/monitoring-usage). If that works, it's much simpler. I am trying to set it up. I've configured my local "env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://app.phoenix.arize.com/s/MY_TEAM",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer MY_TOKEN"
}That isn't working. I also tried changing to: "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://app.phoenix.arize.com/s/MY_TEAM/v1/traces",Still, nothing appears. Am I misconfiguring something or what I'm trying to do isn't supported yet? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You can integrate Claude Code's native OTEL telemetry directly with Phoenix—no proxy needed—but the endpoint and protocol must match Phoenix's OTLP collector, not your Phoenix project URL. Phoenix expects traces via OTLP either over gRPC (default port 4317) or HTTP/protobuf (endpoint path Key points:
Common misconfigurations: Using the Phoenix project URL as the OTEL endpoint, missing Example config for HTTP/protobuf: "env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://app.phoenix.arize.com/v1/traces",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer YOUR_API_KEY"
}If telemetry still doesn't appear, check Claude Code logs for export errors, verify your API key, and confirm endpoint reachability. Let me know if you need help with project naming or debugging specific errors! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Found the issue: Claude Code doesn't send traces, just metrics. There is an issue at anthropics/claude-code#2090 asking to implement this, but it was closed as not planned.
So the proxy seems to be the only way, unfortunately.