Skip to main content
Applies to:
  • Plan -
  • Deployment -

Issue

You want to send Claude Code traces to Braintrust using Claude Code’s native OpenTelemetry (OTEL) integration.

Cause

Claude Code supports OpenTelemetry-based monitoring and tracing. By default, telemetry export is disabled and must be explicitly enabled through environment variables. Braintrust exposes an OTLP-compatible ingestion endpoint that can receive Claude Code traces directly.

Resolution

Enable Claude Code Telemetry

Set the following environment variables before launching Claude Code:

Optional: Capture Prompt and Tool Content

To include prompts, tool invocations, and tool outputs in traces, also configure:

Launch Claude Code

Once the environment variables are configured, start Claude Code normally:

Example Configuration

Notes

Enabling the following options may cause sensitive data to be included in traces:
  • OTEL_LOG_USER_PROMPTS
  • OTEL_LOG_TOOL_DETAILS
  • OTEL_LOG_TOOL_CONTENT
Review your organization’s data handling policies before enabling them in production environments. The x-bt-parent header determines where traces are logged in Braintrust. Replace <PROJECT_ID> with the Braintrust project that should receive the traces.

Additional Resources

If you are able to install Claude Code plugins, we recommend using the trace-claude-code plugin from braintrust-claude-plugin instead of configuring OpenTelemetry manually. The plugin provides native Braintrust tracing for Claude Code and automatically captures sessions, conversation turns, and tool calls as hierarchical traces in Braintrust with minimal setup. :contentReference[oaicite:0] For setup instructions, see: https://www.braintrust.dev/docs/integrations/developer-tools/claude-code#plugin-trace-claude-code The OpenTelemetry configuration described in this article is most useful when:
  • You cannot install Claude Code plugins.
  • You already have an OTEL-based observability pipeline.
  • You want to route Claude Code telemetry through a custom OpenTelemetry configuration.