Skip to main content

Claude Code

Claude Code ships with built-in OpenTelemetry support. Once enabled, Oodle collects metrics and event logs so you can track token usage, costs, session activity, and tool calls across your organization.

Claude Code charts dashboard

Getting Started

1. Enable Telemetry

The fastest way is to use the integration tile in the Oodle UI:

  1. Navigate to Settings → Integrations
  2. Open the AI Agent Observability section
  3. Click the Claude Code Observability tile
  4. Select an API key and follow the steps shown

The tile generates a ready-to-use configuration. To persist settings across sessions and distribute them to your team, add them to the managed settings file (~/.claude/settings.json):

{
"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://<OTLP_ENDPOINT>",
"OTEL_EXPORTER_OTLP_HEADERS": "X-API-KEY=<API_KEY>, X-OODLE-INSTANCE=<INSTANCE_ID>",
"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE": "delta",
"OTEL_LOG_USER_PROMPTS": "1",
"OTEL_LOG_TOOL_DETAILS": "1"
}
}

Replace <OTLP_ENDPOINT>, <API_KEY>, and <INSTANCE_ID> with values from the integration tile.

Alternative: Environment Variables

For quick testing you can export the variables directly in your shell:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<OTLP_ENDPOINT>
export OTEL_EXPORTER_OTLP_HEADERS="X-API-KEY=<API_KEY>, X-OODLE-INSTANCE=<INSTANCE_ID>"
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
export OTEL_LOG_USER_PROMPTS=1
export OTEL_LOG_TOOL_DETAILS=1
tip

For faster feedback during initial setup, lower the export intervals:

export OTEL_METRIC_EXPORT_INTERVAL=10000
export OTEL_LOGS_EXPORT_INTERVAL=5000

2. Roll Out to Your Team

Commit the settings.json above to your dotfiles repository or distribute it via your configuration management tool so every developer picks up the same settings.

3. Verify Data

Once telemetry starts flowing (metrics export every 60 s, events every 5 s by default), navigate to AI Assistants → Claude Code in the Oodle sidebar.

Charts Dashboard

The Charts tab embeds a Grafana dashboard with panels covering:

PanelDescription
Total CostAggregate estimated cost over the selected range
Total TokensSum of input + output tokens
SessionsNumber of CLI sessions started
CommitsCommits created via Claude Code
Pull RequestsPRs created via Claude Code
Token UsageTime series of input vs output tokens
Cost Over TimeTime series of estimated cost by model
Active TimeUser interaction and CLI processing time
Lines of CodeLines added vs removed
Tool CallsTool invocations over time
API RequestsAPI calls by model
DecisionsTool accept / reject decisions

Sessions

Claude Code sessions table

The Sessions tab shows individual Claude Code sessions:

ColumnDescription
Start TimeWhen the session began
UserEmail of the developer
ModelPrimary model used
PromptsNumber of user prompts
DurationWall-clock duration
CostTotal estimated cost
ToolsNumber of tool calls
TokensTotal tokens (input + output)
ErrorsCount of errors

Click any row to open a Session Detail drawer showing a turn-by-turn timeline of every event.

Session Detail Drawer

Claude Code session detail drawer

The drawer displays:

  • Session metadata — user, model, app version, terminal type
  • Aggregated stats — total cost, tokens, tool calls, errors, duration
  • Turn-by-turn timeline — each turn is collapsible and shows the user prompt followed by individual events (API requests, tool calls, decisions). Every event row is expandable to reveal the full raw JSON payload.

What Gets Collected

Metrics

Claude Code exports the following as OpenTelemetry metrics (delta temporality):

MetricLabelsDescription
claude_code_token_usagetype, modelToken count by type (input, output, cache_read, cache_creation)
claude_code_cost_usagemodelEstimated cost in USD
claude_code_session_countSessions started
claude_code_active_timetypeUser and CLI active time
claude_code_lines_of_codetypeLines added / removed
claude_code_num_commitsCommits created
claude_code_num_pull_requestsPull requests created
claude_code_tool_call_counttool_nameTool invocations
claude_code_api_request_countmodelAPI calls by model
claude_code_decisiontypeAccept / reject decisions

Events (Logs)

Events are exported via the OpenTelemetry logs protocol. Each event has a log.attributes.event_type field:

Event TypeKey Attributes
claude_code.user_promptPrompt text (opt-in), character count
claude_code.api_requestModel, cost, input/output tokens, cache tokens, duration
claude_code.tool_resultTool name, success, duration
claude_code.tool_use_decisionDecision (accept/reject), source

Events are grouped by session_id to reconstruct the turn-by-turn timeline on the Sessions tab.

Further Reading


Support

If you need assistance or have any questions, please reach out to us through: