[BUG]
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?
The OTEL_RESOURCE_ATTRIBUTES environment variable is not being applied to metrics export
when we set OTEL_RESOURCE_ATTRIBUTES="user.staff_no=100000" in ~/.claude/settings.json, open telemetry does not add this additional info to the metrics.
this issue is mentioned in #16537 which was closed.
What Should Happen?
when we set OTEL_RESOURCE_ATTRIBUTES="user.staff_no=100000". otel should add label " user.staff_no: 100000 " to the metrics.
Error Messages/Logs
Steps to Reproduce
Edit ~/.claude/settings.json:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_RESOURCE_ATTRIBUTES": "user.staff_no=100000",
"OTEL_LOGS_EXPORTER": "otlp,console",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "<some endpoint>",
"OTEL_EXPORTER_OTLP_HEADERS": "<some header>",
"OTEL_METRICS_EXPORTER": "otlp,console",
"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "<some endpoint>"
}
}
Restart Claude Code
Observe console output for both events and metrics
Notice that user.staff_no is missing in metrics' dataPoints.attributes
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.63
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗