[BUG] otelHeadersHelper is ignored for OTLP over gRPC

Resolved 💬 2 comments Opened Jan 13, 2026 by schallert Closed Feb 27, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Hi folks,

I'm trying to configure dynamic headers with Claude Code's OTel export functionality.

I had the following config in ~/.claude/settings.json:

{
	"otelHeadersHelper": "~/bin/claude-otel-headers.sh",
	"env": {
		"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
		"OTEL_METRICS_EXPORTER": "otlp",
		"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
		"OTEL_EXPORTER_OTLP_ENDPOINT": "https://export-endpoint:4317",
		"OTEL_METRIC_EXPORT_INTERVAL": "5000",
		"OTEL_EXPORTER_OTLP_HEADERS": "Static-Header=foo"
	}
}

~/bin/claude-otel-headers.sh was configured to add X-API-Key=static-value.

With this setup, Static-Header was added to gRPC requests to the export endpoint, but X-API-Key from the header helpers script wasn't.

If I switched the export to http/protobuf with the following config:

{
	"otelHeadersHelper": "~/bin/claude-otel-headers.sh",
	"env": {
		"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
		"OTEL_METRICS_EXPORTER": "otlp",
		"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
		"OTEL_EXPORTER_OTLP_ENDPOINT": "https://export-endpoint:4317",
		"OTEL_METRIC_EXPORT_INTERVAL": "5000",
		"OTEL_EXPORTER_OTLP_HEADERS": "Static-Header=foo"
	}
}

Then I saw both Static-Header _and_ X-API-Key added to requests.

Would it be possible to add headers from the helper script as gRPC metadata over gRPC requests, just as OTEL_EXPORTER_OTLP_HEADERS is treated for gRPC?

Thanks for all your work on Claude Code!

What Should Happen?

Claude should add add headers from the OTel header helper script as gRPC metadata.

Error Messages/Logs

Steps to Reproduce

  1. Create ~/bin/claude-otel-headers.sh with the following content:
#!/bin/bash

echo "{\"X-API-Key\": \"static-value\"}"
  1. Configure Claude to send OTel over http/protobuf with static headers _and_ the helper script:
{
	"otelHeadersHelper": "~/bin/claude-otel-headers.sh",
	"env": {
		"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
		"OTEL_METRICS_EXPORTER": "otlp",
		"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
		"OTEL_EXPORTER_OTLP_ENDPOINT": "https://export-endpoint:4317",
		"OTEL_METRIC_EXPORT_INTERVAL": "5000",
		"OTEL_EXPORTER_OTLP_HEADERS": "Static-Header=foo"
	}
}
  1. Introspect headers sent to the OTel endpoint; no values from the helper script are added.
  2. Switch protocol to http/protobuf, restart Claude, observe that script headers are added.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.6 (Claude Code)

Platform

Google Vertex AI

Operating System

macOS

Terminal/Shell

Other

Additional Information

Terminal: Ghostty

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗