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.
When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.
Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.
Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.