[BUG] OTEL_LOGS_EXPORTER=none crashes entire telemetry init, preventing metrics export
Bug Description
Setting OTEL_LOGS_EXPORTER=none (a standard OpenTelemetry SDK value meaning "disable this signal") causes Claude Code's entire telemetry initialization to crash, silently disabling all OTEL export including metrics and traces.
Steps to Reproduce
- Configure Claude Code for OTLP metrics export to a third-party backend (e.g., New Relic):
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "none",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otlp.nr-data.net",
"OTEL_EXPORTER_OTLP_HEADERS": "api-key=<YOUR_KEY>"
}
}
- Launch Claude Code with
--debug - Check
~/.claude/debug/latest
Expected Behavior
OTEL_LOGS_EXPORTER=none should disable log export without affecting metrics or traces, consistent with the OpenTelemetry Environment Variable Specification.
Actual Behavior
Debug log shows:
[3P telemetry] isTelemetryEnabled=true (CLAUDE_CODE_ENABLE_TELEMETRY=1)
[3P telemetry] getOtlpLogExporters: types=["none"], protocol=http/protobuf, endpoint=https://otlp.nr-data.net
[3P telemetry] Telemetry init failed: Unknown exporter type set in OTEL_LOGS_EXPORTER env var: none
The entire telemetry pipeline (metrics, logs, and traces) is aborted because the log exporter parser throws an unhandled error.
Root Cause
In the telemetry init code, the log exporter parser (AWR / getOtlpLogExporters) only recognizes "console", "otlp", and "prometheus". The value "none" falls through to the else throw branch. Since this error is not caught per-signal, it aborts the entire fWR() init function — including the metrics exporter that was configured correctly.
The same issue likely applies to OTEL_METRICS_EXPORTER=none and OTEL_TRACES_EXPORTER=none.
Suggested Fix
Filter out "none" (and optionally "noop") before iterating over exporter types, treating it equivalently to an empty string. For example:
// Before creating exporters, filter out "none" per OTEL spec
const types = (process.env.OTEL_LOGS_EXPORTER || "")
.trim()
.split(",")
.filter(Boolean)
.filter(t => t !== "none"); // <-- add this
This should be applied to all three exporter parsers (metrics, logs, traces).
Workaround
Set OTEL_LOGS_EXPORTER="" (empty string) instead of "none".
Environment
- Claude Code version: 2.1.81
- Platform: macOS (darwin arm64)
- Auth: AWS Bedrock
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗