claude-code - 💡(How to fix) Fix 3P OpenTelemetry telemetry not initializing on enterprise/managed accounts (Windows) [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46204Fetched 2026-04-11 06:26:24
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4commented ×1

OpenTelemetry 3rd-party telemetry export does not initialize on enterprise/managed accounts when running Claude Code on Windows. Environment variables are correctly set and visible in the Claude Code Node.js process, but no OTLP connections are established and no data is exported — not even with console exporters.

Error Message

// ← Error is swallowed here, user never sees it

Root Cause

Root cause analysis (from source code investigation)

Code Example

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

---

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

---

_r8() → checks Eo1() (managed account?) → waits for fu8()cl()J$7()S6Y()

---

fu8().then(async () => {
  cl();
  await J$7();
}).catch((q) => {
  N(`[3P telemetry] Telemetry init failed (remote settings path): ${U6(q)}`);
  // ← Error is swallowed here, user never sees it
});

---

function jJ() {
  if (!(B6(process.env.ENABLE_BETA_TRACING_DETAILED) && Boolean(process.env.BETA_TRACING_ENDPOINT)))
    return false;
  return Q7() || h8("tengu_trace_lantern", false);  // feature flag not set
}
RAW_BUFFERClick to expand / collapse

Summary

OpenTelemetry 3rd-party telemetry export does not initialize on enterprise/managed accounts when running Claude Code on Windows. Environment variables are correctly set and visible in the Claude Code Node.js process, but no OTLP connections are established and no data is exported — not even with console exporters.

Environment

  • Claude Code version: 2.1.98 (@anthropic-ai/claude-code)
  • Platform: Windows 11 Pro 10.0.22631
  • Node.js: v25.3.0
  • Shell: Git Bash (via PowerShell terminal)
  • Account type: Enterprise/managed (OAuth authentication)
  • Docker: Rancher Desktop (containers running on WSL2)

Configuration

Exact configuration as documented at https://code.claude.com/docs/en/monitoring-usage:

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

Also tested with:

  • http/json protocol on port 4318
  • http/protobuf protocol on port 4318
  • console exporters (no output produced)
  • OTEL_METRICS_EXPORTER=none (logs only)
  • Various combinations of the above

Verified conditions

1. Environment variables ARE set in the Claude Code process

Confirmed via PowerShell GetProcessById().StartInfo.EnvironmentVariables:

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

2. OTel Collector is running and reachable

All containers healthy (Grafana, Loki, Prometheus, Tempo, OTel Collector). Manual OTLP requests from both curl and Node.js succeed — data arrives in Loki.

3. Claude Code never connects to the collector

Verified via Get-NetTCPConnection — the Claude Code process has zero TCP connections to ports 4317 or 4318. Only connections to Anthropic API servers (port 443).

4. Console exporter produces no output

With OTEL_METRICS_EXPORTER=console and OTEL_LOGS_EXPORTER=console, no JSON telemetry data appears in the terminal. This confirms the telemetry pipeline is never initialized, not a network/connectivity issue.

5. No managed settings file exists

Checked C:\ProgramData\ClaudeCode\managed-settings.json — directory does not exist. No MDM-deployed configuration overriding user settings.

Root cause analysis (from source code investigation)

We traced the initialization flow in the minified cli.js (v2.1.98):

Telemetry init flow

_r8() → checks Eo1() (managed account?) → waits for fu8() → cl() → J$7() → S6Y()

Managed path routing

The account's OAuth token has subscriptionType === null, causing the yF() function to return true. This routes telemetry init through the managed path, which:

  1. Creates a Promise (B56) with a 30-second timeout
  2. Attempts to fetch remote managed settings from ${BASE_API_URL}/api/claude_code/settings
  3. After timeout or settings load, calls cl() (applies config to process.env) then J$7() (initializes exporters)

However, something in this chain fails silently — the .catch() handler only logs internally via an opaque N() function that is not visible to the user:

fu8().then(async () => {
  cl();
  await J$7();
}).catch((q) => {
  N(`[3P telemetry] Telemetry init failed (remote settings path): ${U6(q)}`);
  // ← Error is swallowed here, user never sees it
});

Beta tracing path also blocked

The beta tracing path (h6Y()) requires a feature flag tengu_trace_lantern that is not enabled for this account:

function jJ() {
  if (!(B6(process.env.ENABLE_BETA_TRACING_DETAILED) && Boolean(process.env.BETA_TRACING_ENDPOINT)))
    return false;
  return Q7() || h8("tengu_trace_lantern", false);  // feature flag not set
}

In interactive mode, Q7() returns false (!isInteractive), and the feature flag is not set, so the beta path is never taken.

Expected behavior

With CLAUDE_CODE_ENABLE_TELEMETRY=1 and valid OTEL exporter configuration, Claude Code should export telemetry data to the configured endpoint, regardless of account type (personal, team, enterprise).

Actual behavior

No telemetry data is exported. No connections are made to the OTEL collector. Console exporters produce no output. The telemetry initialization fails silently on the managed/enterprise account path.

Steps to reproduce

  1. Use an enterprise/managed OAuth account (organization with subscriptionType === null)
  2. Set environment variables as documented
  3. Run claude or claude --resume
  4. Observe no OTLP connections and no console exporter output

Suggested improvements

  1. Surface telemetry initialization errors — at minimum via stderr or a debug log file, so users can diagnose failures
  2. Ensure the managed settings path doesn't silently prevent telemetry init — if remote settings fail to load, telemetry should still initialize with user-provided env vars
  3. Add a claude telemetry status diagnostic command to help users verify their telemetry configuration is working

extent analysis

TL;DR

The most likely fix for the OpenTelemetry initialization issue on enterprise/managed accounts is to modify the Claude Code to surface telemetry initialization errors and ensure the managed settings path doesn't silently prevent telemetry initialization.

Guidance

  • Investigate the fu8() function and the N() logging function to understand why the error is being swallowed and not visible to the user.
  • Consider adding error handling to the catch block to log the error to stderr or a debug log file, allowing users to diagnose failures.
  • Review the managed settings path to ensure that if remote settings fail to load, telemetry still initializes with user-provided environment variables.
  • Implement a claude telemetry status diagnostic command to help users verify their telemetry configuration is working.

Example

No code snippet is provided as the issue is related to the internal implementation of the Claude Code and requires modifications to the existing codebase.

Notes

The provided analysis is based on the given issue content and may not be comprehensive. Further investigation into the Claude Code source code and the OpenTelemetry library may be necessary to fully resolve the issue.

Recommendation

Apply a workaround by modifying the Claude Code to surface telemetry initialization errors and ensure the managed settings path doesn't silently prevent telemetry initialization. This will allow users to diagnose and potentially fix the issue until a permanent solution is implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

With CLAUDE_CODE_ENABLE_TELEMETRY=1 and valid OTEL exporter configuration, Claude Code should export telemetry data to the configured endpoint, regardless of account type (personal, team, enterprise).

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix 3P OpenTelemetry telemetry not initializing on enterprise/managed accounts (Windows) [1 comments, 1 participants]