Control OTel Metrics Cardinality to Reduce Storage Costs
Every unique combination of metric attributes creates a separate time series. If you're exporting Claude Code metrics to Prometheus or Datadog, high cardinality means high storage bills. Three environment variables let you trim what gets attached.
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
# Drop session IDs from metrics (big cardinality saver)
export OTEL_METRICS_INCLUDE_SESSION_ID=false
# Include app version for release tracking
export OTEL_METRICS_INCLUDE_VERSION=true
# Drop individual account IDs if you only need org-level data
export OTEL_METRICS_INCLUDE_ACCOUNT_UUID=false
session.id is the biggest cardinality driver since every session creates a unique value. If you're tracking costs at the team level, you probably don't need per-session granularity in your metrics. Disable it with OTEL_METRICS_INCLUDE_SESSION_ID=false and rely on events (which always include it) for session-level debugging.
For multi-team setups, use OTEL_RESOURCE_ATTRIBUTES to add custom dimensions like department=engineering,cost_center=eng-123 instead of relying on high-cardinality user IDs.
Lower cardinality means faster queries, cheaper storage, and dashboards that actually load.
Log in to leave a comment.
The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.
The language setting makes Claude respond in your preferred language by default, across every session and project.
The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.