Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin Chain SAFU CryptoTax DeFAI AGI Claude Me Claude Skill Claude Design Claude Cowork
Independent Media
Not affiliated with any project
Learn Claude Skills. Do Everything Better.
claudeskill-me.com
LATEST
Watching Claude Code Compaction and Hooks Through OpenTelemetry: Reading the compaction, hook_execution_complete and precompute_reuse Fields  ·  Blind Spots in Bash Permission Rules: deny Misses /bin/rm, bash -c and git -C, and devbox run * Lets Any Inner Command Through  ·  CLAUDE.md Too Long? Use .claude/rules/ and paths So Rules Load Only When Claude Touches Matching Files  ·  Chromium Says No usable sandbox! Inside Claude Code's Sandbox: What --no-sandbox, excludedCommands and allowNestedUserNamespaces Each Give Up  ·  Claude Code v2.1.309 Fixes a Batch of Sandbox and Permission Gaps: Startup Files Outside the Sandbox, denyWrite Through Symlinks and More  ·  The auto mode $defaults Trap: Leave One String Out of autoMode.soft_deny and the Built-In Force-Push Rules Disappear
Glossary · Tools Integration

OpenTelemetry

Tools Integration advanced

30-Second Version · For the impatient
An industry-standard observability framework; Claude Code can use it to export usage metrics and behavior events (Compaction, hooks, tool decisions and more) to your collector, enabled by setting CLAUDE_CODE_ENABLE_TELEMETRY=1.
Full Explanation +
01 · What is this?

What is OpenTelemetry and how does Claude Code use it?

OpenTelemetry (OTel) is an open standard for observability, defining how metrics, events (logs) and traces are exported. The official monitoring docs say that with CLAUDE_CODE_ENABLE_TELEMETRY=1, Claude Code can emit claude_code.* events such as user_prompt, tool_decision, Compaction, hook_registered, hook_execution_complete, at_mention and api_retries_exhausted.

02 · Why does it exist?

Why does it exist?

On your own machine you see what Claude Code does on screen, but a team or CI that needs to answer "who loaded which hooks", "did Compaction fail" or "which tools were rejected" needs structured records. OTel lets that data flow into the observability stack you already have instead of a vendor-specific format.

03 · How does it affect your decisions?

How do I turn it on?

The docs' minimal setup: CLAUDE_CODE_ENABLE_TELEMETRY=1 (required) and OTEL_LOGS_EXPORTER set to otlp, console or none; to send to a collector also set OTEL_EXPORTER_OTLP_PROTOCOL (no default, you must set it) and OTEL_EXPORTER_OTLP_ENDPOINT, with OTEL_LOGS_EXPORT_INTERVAL defaulting to 5000 ms. Seeing claude_code.user_prompt after you submit a prompt confirms it works. Tool parameters and similar detail are not recorded by default; set OTEL_LOG_TOOL_DETAILS=1.

04 · What should you do?

So what does this mean for me?

If you manage a team's Claude Code use, turn on console output once to see what the events look like before choosing a backend. Note that events are not complete audit evidence and some fields need extra switches; I have not stood up a collector to test.

Sources: Monitoring - Claude Code Docs, Claude Code changelog - Claude Code Docs
Real-World Example +

A publicly checkable example: the claude_code.compaction event carries trigger, pre_tokens, post_tokens and precompute_reuse (hit or miss_*), which can be used to count how often compaction happens and whether it reused a summary prepared in the background.

Common Misconceptions +
✕ Misconception 1
× Misconception: OpenTelemetry only shows tokens and cost, when actually: the official docs also list compaction, hook, tool-decision, at-mention and API-retries-exhausted events
✕ Misconception 2
× Misconception: setting OTEL_LOGS_EXPORTER is enough to get data, when actually: CLAUDE_CODE_ENABLE_TELEMETRY=1 is also required, and with otlp OTEL_EXPORTER_OTLP_PROTOCOL has no default
The Missing Link +
Direct Impact

Pros: a standard format, flows into an existing observability stack, fine-grained events. Cons: you must run the collector and dashboards yourself, and events are a session-level record, not a full audit.

Ask a Question
Please enter at least 10 characters
More Related Topics