Monitor your Claude usage
Source: Dev.to
Enabling Claude telemetry
The official Claude Code CLI can emit OpenTelemetry telemetry.
Enable it by setting the following environment variables in your shell (or per session):
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel.local.net
Once these variables are exported, the CLI will start sending metrics, logs, and traces to the configured OpenTelemetry endpoint.
Visualizing with SigNoz
I already run an OpenTelemetry collector in a centralized location that receives data from all of my services and applications. If you need to set up your own collector, see the SigNoz guide on OpenTelemetry collection.
After the Claude CLI starts emitting telemetry, SigNoz can ingest the data and provide visualizations.
Dashboard overview
I created a simple SigNoz dashboard that highlights the most relevant information about my Claude usage:
- Cost
- Token usage
- Model usage
- Input and output tokens
- Average request duration
These panels let me quickly assess the financial and performance impact of each request.
Practical uses
- Cost alerts – Set up an alert when the accumulated cost approaches a predefined limit.
- Prompt efficiency – Review the length and token usage of prompts to make them more economical.
- Model comparison – See a breakdown of usage per model to determine which one performs best for a given task.
- Output control – Refine prompts to better manage the number of output tokens generated.