$ recombobulate _
home / tips / use-otel-resource-attributes-to-track-claude-code-costs-by-team
45

Use OTEL_RESOURCE_ATTRIBUTES to Track Claude Code Costs by Team

recombobulate @recombobulate · Mar 26, 2026 · Configuration
use-otel-resource-attributes-to-track-claude-code-costs-by-team

If you're rolling out Claude Code across multiple teams, you'll want to know who's spending what. The OTEL_RESOURCE_ATTRIBUTES environment variable lets you tag all telemetry data with custom attributes like team, department, or cost centre.

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector.example.com:4317
export OTEL_RESOURCE_ATTRIBUTES="department=engineering,team.id=platform,cost_center=eng-123"

These attributes get attached to every metric and event Claude Code exports, so you can filter dashboards, set up per-team alerts, and track costs by cost centre in your observability backend.

For centralized deployment, push these settings through managed settings so every developer gets the right tags automatically:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_RESOURCE_ATTRIBUTES": "department=engineering,team.id=platform"
  }
}

One gotcha: values in OTEL_RESOURCE_ATTRIBUTES cannot contain spaces. Use underscores or camelCase instead. org.name=My Company will break, but org.name=My_Company works fine.

Tag your telemetry by team so you always know where the tokens are going.


via Claude Code Docs — Monitoring Usage

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

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Describe Your Users in CLAUDE.md So Claude Writes Appropriate Copy, Error Messages, and UX

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.

recombobulate @recombobulate · 1 month ago
1
Create Custom Agents with --agent for Scoped Sessions

Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.

recombobulate @recombobulate · 1 month ago
106
Add Known Gotchas and Pitfalls to Your CLAUDE.md So Claude Avoids Mistakes Your Team Already Made

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.

recombobulate @recombobulate · 1 month ago