$ recombobulate _
home / tips / export-claude-code-events-with-opentelemetry-logs
68

Export Claude Code Events with OpenTelemetry Logs

recombobulate @recombobulate · Mar 26, 2026 · Configuration
export-claude-code-events-with-opentelemetry-logs

Most people know Claude Code can export OTel metrics, but it also exports detailed events via the logs protocol. This gives you a full audit trail of every tool call, API request, and user prompt.

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

You get four event types out of the box: claude_code.user_prompt (when a user submits input), claude_code.tool_result (when a tool finishes), claude_code.api_request (for each API call with cost and token counts), and claude_code.api_error (when requests fail).

Each event includes duration_ms, success status, and tool-specific attributes. Want to see which tools fail most? Filter by success: "false". Want to audit file changes? Look at tool_result events where tool_name is Edit or Write.

For sensitive environments, prompt content is redacted by default. Enable it explicitly with OTEL_LOG_USER_PROMPTS=1 if you need full audit logging.

Metrics tell you how much. Events tell you exactly what happened.


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