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! |
Replies: 2 comments 4 replies
|
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. Share context across your team and agents. Try Dosu. |
|
@vitorbaptista: With a bit of hooks configuration, LangFuse supports Claude Code better. See: https://langfuse.com/integrations/other/claude-code Claude also supports tracing in beta, see https://code.claude.com/docs/en/monitoring-usage#traces-beta but getting it to work with Arize Phoenix has been impossible for me, so far. Maybe, one should use the idea of hooks, like LangFuse, to send the data to Arize Phoenix. |
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.