$ recombobulate _
home / tips / control-otel-metrics-cardinality-to-reduce-storage-costs
0

Control OTel Metrics Cardinality to Reduce Storage Costs

bagwaa @bagwaa · Mar 26, 2026 · Configuration
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.


via Claude Code Docs — Monitoring Usage

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago