SigNoz
Docs
PricingCustomers
Get Started - Free
Docs
IntroductionContributingMigrate from DatadogSigNoz API
OpenTelemetry
What is OpenTelemetryOpenTelemetry Collector GuideOpenTelemetry Demo
Community
Support
Slack
X
Launch Week
Changelog
Dashboard Templates
DevOps Wordle
Newsletter
KubeCon, Atlanta 2025
More
SigNoz vs DatadogSigNoz vs New RelicSigNoz vs GrafanaSigNoz vs Dynatrace
Careers
AboutTermsPrivacySecurity & Compliance
SigNoz - Open Source Datadog Alternative
SigNoz
All systems operational
HIPAASOC-2
SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

Claude Code Monitoring & Observability with OpenTelemetry

Overview

Claude Code monitoring with OpenTelemetry gives you full visibility into how Claude is used across your engineering team. This guide walks you through exporting Claude Code logs and metrics to SigNoz, so you can track the signals that matter most:

  • Token usage & costs — break down spend by user, model, or subagent
  • Session & request activity — track adoption, active time, and request volumes
  • Performance — monitor API latency, cache hit rates, and tool execution times
  • Quota & limits — stay ahead of rate limits before they impact developers
  • Tool decisions — see accept/reject rates across Edit, Write, and other tools
  • Errors & retries — detect API failures and retry exhaustion before they snowball

Once set up, all of this flows into SigNoz dashboards where you can correlate logs and metrics, set alerts, and analyze trends over time.

Prerequisites

  • SigNoz setup (choose one):
    • SigNoz Cloud account with an active ingestion key
    • Self-hosted SigNoz instance
  • Internet access to send telemetry data to SigNoz Cloud
  • Claude Code installed and running on your system

Monitoring Claude Code

Check out detailed instructions on how to set up OpenTelemetry instrumentation for your Claude Code usage over here.

Option 1 (VSCode)

Step 1: Launch VSCode with telemetry enabled

CLAUDE_CODE_ENABLE_TELEMETRY=1 \
OTEL_METRICS_EXPORTER=otlp \
OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443" \
OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>" \
OTEL_METRIC_EXPORT_INTERVAL=10000 \
OTEL_LOGS_EXPORT_INTERVAL=5000 \
code .
  • <region>: Your SigNoz Cloud region
  • <your-ingestion-key>: Your SigNoz ingestion key

Using self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in Cloud → Self-Hosted.

This will open VSCode with the required environment variables already configured. From here, any Claude Code activity will automatically generate telemetry and export logs to your SigNoz Cloud instance.

For convenience, you can also clone our bash script, update it with your SigNoz endpoint and ingestion key, and run it directly.

Option 2 (Terminal)

Step 1: Launch Claude Code with telemetry enabled

CLAUDE_CODE_ENABLE_TELEMETRY=1 \
OTEL_METRICS_EXPORTER=otlp \
OTEL_LOGS_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.<region>.signoz.cloud:443" \
OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key=<your-ingestion-key>" \
OTEL_METRIC_EXPORT_INTERVAL=10000 \
OTEL_LOGS_EXPORT_INTERVAL=5000 \
claude
  • Set the <region> to match your SigNoz Cloud region
  • Replace <your-ingestion-key> with your SigNoz ingestion key

Using self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in Cloud → Self-Hosted.

This will launch Claude Code with telemetry enabled. Any Claude Code activity in the terminal session will automatically generate and export logs and metrics to your SigNoz Cloud instance.

For convenience, you can also clone our bash script, update it with your SigNoz endpoint and ingestion key, and run it directly.

Administrator Configuration

Administrators can configure OpenTelemetry settings for all users through the managed settings file. This allows for centralized control of telemetry settings across an organization. See the settings precedence for more information about how settings are applied.

The managed settings file is located at:

  • macOS: /Library/Application Support/ClaudeCode/managed-settings.json
  • Linux and WSL: /etc/claude-code/managed-settings.json
  • Windows: C:\ProgramData\ClaudeCode\managed-settings.json

Example managed settings configuration:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://collector.company.com:4317",
    "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer company-token"
  }
}

Managed settings can be distributed via MDM (Mobile Device Management) or other device management solutions. Environment variables defined in the managed settings file have high precedence and cannot be overridden by users.

Example Configurations

# Console debugging (1-second intervals)
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
export OTEL_METRIC_EXPORT_INTERVAL=1000

# OTLP/gRPC
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

# Prometheus
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=prometheus

# Multiple exporters
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console,otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/json

# Different endpoints/backends for metrics and logs
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://metrics.company.com:4318
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://logs.company.com:4317

# Metrics only (no events/logs)
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

# Events/logs only (no metrics)
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

Your Claude Code activity should now automatically emit logs and metrics.

Finally, you should be able to view logs in Signoz Cloud under the logs tab:

Claude Code monitoring logs in SigNoz
Logs View of your Claude Code Activity

When you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:

Claude Code user_prompt event details in SigNoz
Detailed Logs View of claude_code.user_prompt
Claude Code api_request event details in SigNoz
Detailed Logs View of claude_code.api_request
Claude Code tool_decision event details in SigNoz
Detailed Logs View of claude_code.tool_decision
Claude Code tool_result event details in SigNoz
Detailed Logs View of claude_code.tool_result

You should be able to see Claude Code related metrics in Signoz Cloud under the metrics tab:

Claude Code metrics in SigNoz
Metrics View of your Claude Code Activity

When you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:

Claude Code token usage and cost metrics detail in SigNoz
Detailed Metrics View of your Claude Code Activity

Dashboard

You can also check out our custom Claude Code dashboard here which provides specialized visualizations for monitoring your Claude Code usage. The dashboard includes pre-built charts specifically tailored for LLM usage, along with import instructions to get started quickly.

Claude Code Dashboard
Claude Code Dashboard - Credit: Mike Lane

Telemetry Data

Claude Code emits the following metrics and events via OpenTelemetry. For the full upstream specification, see the Claude Code monitoring docs.

Standard Attributes

Every metric and event includes these attributes:

AttributeDescription
session.idUnique session identifier
user.idAnonymous device/installation identifier
user.emailUser email address (when authenticated via OAuth)
user.account_uuidAccount UUID (when authenticated)
user.account_idAccount ID matching Anthropic admin APIs (when authenticated)
organization.idOrganization UUID (when authenticated)
terminal.typeTerminal type, e.g. vscode, iTerm.app, cursor, tmux
app.versionClaude Code version (opt-in via OTEL_METRICS_INCLUDE_VERSION=true)

Metrics

MetricDescriptionUnitKey Attributes
claude_code.session.countSessions startedcountstart_type (fresh, resume, continue)
claude_code.token.usageTokens used per API requesttokenstype (input, output, cacheRead, cacheCreation), model, query_source, speed
claude_code.cost.usageEstimated cost per API requestUSDmodel, query_source, speed, agent.name, skill.name, effort
claude_code.lines_of_code.countLines of code added or removedcounttype (added, removed)
claude_code.commit.countGit commits createdcount—
claude_code.pull_request.countPull requests or merge requests createdcount—
claude_code.code_edit_tool.decisionEdit/Write/NotebookEdit permission decisionscounttool_name, decision (accept/reject), source, language
claude_code.active_time.totalActive usage timesecondstype (user for keyboard input, cli for tool/AI response time)

Events

Claude Code emits these events via the OpenTelemetry logs/events protocol (when OTEL_LOGS_EXPORTER is configured):

EventEmitted WhenKey Attributes
claude_code.user_promptUser submits a promptprompt_length, command_name, command_source, prompt (redacted by default — enable with OTEL_LOG_USER_PROMPTS=1)
claude_code.api_requestAPI request to Claude completesmodel, cost_usd, duration_ms, input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens, request_id, speed, query_source
claude_code.api_errorAPI request fails after all retriesmodel, error, status_code, duration_ms, attempt, speed, query_source
claude_code.api_retries_exhaustedAll retry attempts are exhaustedmodel, error, total_attempts, total_retry_duration_ms, status_code
claude_code.tool_resultTool execution completestool_name, success, duration_ms, decision_type, decision_source, error_type, tool_input_size_bytes, tool_result_size_bytes
claude_code.tool_decisionTool permission is accepted or rejectedtool_name, decision (accept/reject), source (config, hook, user_permanent, user_temporary, user_abort, user_reject)
claude_code.permission_mode_changedPermission mode switchesfrom_mode, to_mode, trigger (shift_tab, exit_plan_mode, auto_gate_denied, auto_opt_in)
claude_code.mcp_server_connectionMCP server connects, fails, or disconnectsstatus (connected, failed, disconnected), transport_type, server_scope, duration_ms, error_code
claude_code.auth/login or /logout completesaction (login/logout), success, auth_method, error_category
claude_code.compactionConversation compaction completestrigger (auto/manual), success, pre_tokens, post_tokens, duration_ms
claude_code.internal_errorUnexpected internal error is caughterror_name, error_code
claude_code.plugin_installedPlugin finishes installingplugin.name, marketplace.name, install.trigger
claude_code.plugin_loadedPlugin is active at session startplugin.name, plugin.scope, plugin.version, enabled_via
claude_code.skill_activatedSkill is invoked by Claude or as a / commandskill.name, invocation_trigger, skill.source
claude_code.hook_execution_completeAll hooks for a hook event finishhook_event, hook_name, num_hooks, num_success, num_blocking, total_duration_ms
claude_code.feedback_surveySession quality survey is shown or answeredevent_type, survey_type, response

All events share a prompt.id attribute, a UUID that links every event produced while processing a single user prompt. Filter by prompt.id in SigNoz to correlate all API requests and tool executions triggered by one prompt.

Troubleshooting

If you don't see your telemetry data in SigNoz:

  1. Check CLAUDE_CODE_ENABLE_TELEMETRY - This must be set to 1. Telemetry is opt-in and nothing is exported without it
  2. Verify your region and ingestion key - An incorrect <region> or <your-ingestion-key> will silently drop all data. Double-check against your SigNoz Cloud settings
  3. Check both exporters are set - OTEL_METRICS_EXPORTER controls metrics and OTEL_LOGS_EXPORTER controls events. If only one is set, the other signal will not appear
  4. Try a console exporter - Set OTEL_METRICS_EXPORTER=console and OTEL_LOGS_EXPORTER=console to confirm Claude Code is generating telemetry locally before sending to SigNoz
  5. Wait for the export interval - The default metrics export interval is 60 seconds. During setup, set OTEL_METRIC_EXPORT_INTERVAL=10000 to flush every 10 seconds instead
  6. Confirm env vars are set before launch - Environment variables must be set before launching claude or code .. Variables exported after launch have no effect

FAQs

Does Claude Code have built-in monitoring?

A. Yes. Claude Code has native OpenTelemetry support that you opt into by setting CLAUDE_CODE_ENABLE_TELEMETRY=1. Once enabled, it emits metrics (token usage, costs, session counts, lines of code, commits) and structured log events (API requests, tool executions, permission decisions) via the standard OTLP protocol to any compatible backend including SigNoz.

How do I track Claude Code token usage?

A. Claude Code emits a claude_code.token.usage metric after every API request, broken down by type (input, output, cacheRead, cacheCreation), model, and query_source. In SigNoz, filter this metric by user or model to see exactly where tokens are going. See the Telemetry Data section for the full attribute list.

Can I monitor Claude Code costs with OpenTelemetry?

A. Yes. The claude_code.cost.usage metric tracks estimated USD cost per API request and includes attributes for model, agent.name, skill.name, and query_source, so you can break down spend by team, model, or workflow. Note that these are approximations — for billing data, refer to your Anthropic Console or cloud provider.

How do I monitor Claude Code across an entire team?

A. Use the Administrator Configuration section to deploy a managed settings file (managed-settings.json) via MDM or your device management solution. This sets CLAUDE_CODE_ENABLE_TELEMETRY=1 and the SigNoz endpoint centrally for all users, without requiring each developer to configure env vars individually.

What is the difference between Claude Code metrics and events?

A. Metrics (like claude_code.token.usage and claude_code.cost.usage) are numeric time-series data, ideal for dashboards, aggregations, and alerts. Events (like claude_code.api_request and claude_code.tool_result) are structured log records emitted per action, ideal for audit trails, debugging, and tracing individual sessions. Both are exported via OpenTelemetry but require separate exporter configuration (OTEL_METRICS_EXPORTER vs OTEL_LOGS_EXPORTER).

Related Articles

Bringing Observability to Claude Code: OpenTelemetry in Action

A practical walkthrough of how to connect Claude Code's monitoring hooks with OpenTelemetry and visualize usage, costs, and performance in SigNoz dashboards.

Is Claude Code Getting Worse? How to Measure Degradation with OpenTelemetry

Learn how to track output-per-token ratios across commits, PRs, and lines of code to detect whether Claude Code's efficiency is degrading over time.

Last updated: May 19, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.

Prev
Baseten
Next
Claude Agent SDK
On this page
Overview
Prerequisites
Monitoring Claude Code
Option 1 (VSCode)
Option 2 (Terminal)
Administrator Configuration
Example Configurations
Dashboard
Telemetry Data
Standard Attributes
Metrics
Events
Troubleshooting
FAQs
Does Claude Code have built-in monitoring?
How do I track Claude Code token usage?
Can I monitor Claude Code costs with OpenTelemetry?
How do I monitor Claude Code across an entire team?
What is the difference between Claude Code metrics and events?
Related Articles

Is this page helpful?

Your response helps us improve this page.