[BUG] `otelHeadersHelper` does not get used for OTLP gRPC exporter
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?
This is a duplicate of #18000 because that was closed due to being "stale".
When otelHeadersHelper is set in the settings, the headers from that script output are not added to gRPC metadata when the gRPC exporter is in use, i.e. OTEL_EXPORTER_OTLP_PROTOCOL=grpc.
It does work and be added to HTTP request headers when using the HTTP exporter, i.e. OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf or OTEL_EXPORTER_OTLP_PROTOCOL=http/json.
What Should Happen?
When otelHeadersHelper is set in the settings, the headers from that script output are not added to gRPC metadata
Error Messages/Logs
Steps to Reproduce
Set a config like
{
"otelHeadersHelper": "... some script ...",
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://some-host:4317"
}
}
Run claude.
Observe that the values returned by the script are not included in gRPC metadata.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.77
Platform
Other
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗