# Claude Code

> Export Claude Code interaction, model-request and tool spans to Radiant Platform.

Export Claude Code’s coding-session activity to Radiant over OTLP. Its traces record interactions, model requests and tool execution. To let Claude query Radiant’s project data instead, [connect it through MCP](/docs/platform/integrations/mcp.md).

Use a current Claude Code installation and the endpoint and ingestion key from [Set up your project](/docs/platform/set-up-your-project.md). Your existing Claude sign-in remains unchanged.

## Enable trace export

Set these variables in the environment that launches Claude Code. The traces-specific endpoint includes `/v1/traces`:

**Claude Code environment**

```sh
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL='http/protobuf'
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT='https://YOUR_INGESTION_HOST/v1/traces'
export OTEL_EXPORTER_OTLP_TRACES_HEADERS='Authorization=Bearer%20YOUR_INGESTION_KEY'
export OTEL_SERVICE_NAME='claude-code'
```

Keep the ingestion key in your private environment configuration. The space after `Bearer` is percent-encoded in the OpenTelemetry header variable. These settings configure traces; leave any existing log and metric exporters pointed at their own destinations.

Start a new session from that environment with `claude`, or use `claude -p` in an existing automation. Complete a normal request and let the process exit normally so its buffered spans can flush.

## Add resource attributes

To label telemetry by environment or team, set `OTEL_RESOURCE_ATTRIBUTES` in the same launch environment:

**Optional resource attributes**

```sh
export OTEL_RESOURCE_ATTRIBUTES='deployment.environment.name=development,team.name=platform'
```

These labels apply to telemetry from that Claude Code process, rather than an individual model request or tool call. Use comma-separated `key=value` pairs without spaces; Anthropic’s [custom attribute reference](https://code.claude.com/docs/en/monitoring-usage#multi-team-organization-support) describes the supported format.

## Find the session in Radiant

Open the project’s **Logs** and find the interaction in **All agent runs**. Radiant recognizes Claude Code’s invocation marker and uses **Claude Code** as the agent identity when the exporter does not supply one. Open a run to inspect its model requests and tool operations; tool execution has separate spans for permission waiting and execution.

Use **Conversations** to follow interactions from the same coding session. Claude Code records `gen_ai.conversation.id`, which groups those runs together. **All traces** also contains the original `claude_code.interaction`, model and tool records.

## Choose what content to export

Prompt text and tool details are redacted by default. To include them, set only the controls needed for your investigation before starting the session:

**Optional content capture**

```sh
export OTEL_LOG_USER_PROMPTS=1
export OTEL_LOG_TOOL_DETAILS=1
export OTEL_LOG_TOOL_CONTENT=1
```

These controls can export prompts, file paths, commands and tool results. Inspect them as recorded attributes and events. Capturing those native fields does not by itself provide the structured model messages used by the [Thread tab](/docs/platform/logs/threads.md).

Managed Claude Code settings can override developer-supplied endpoints or credentials. If traces do not arrive, check those settings and the [export troubleshooting guide](/docs/platform/reference/telemetry.md#troubleshoot-tracing). Anthropic’s [monitoring reference](https://code.claude.com/docs/en/monitoring-usage#traces-beta) documents the supported spans and capture controls.
