[FEATURE] Allow overriding OTEL resource attributes (e.g., user.email) for Bedrock users
Summary
When using Claude Code with AWS Bedrock (CLAUDE_CODE_USE_BEDROCK=1), the user.email OTEL resource attribute is always empty because there is no Anthropic account. Allow users to override this via environment variable or config.
Motivation
Organizations using Bedrock want to track Claude Code usage per user in their observability stack (Datadog, Grafana, etc.). Currently, user.email is only populated from the Anthropic account, which doesn't exist for Bedrock users.
Additionally, standard OTEL environment variables like OTEL_RESOURCE_ATTRIBUTES are ignored — Claude Code builds its own resource attributes without merging user-provided values.
Proposed Solution
Either:
- Respect
OTEL_RESOURCE_ATTRIBUTES— Merge user-provided attributes with built-in ones - Add specific env vars — e.g.,
CLAUDE_CODE_USER_EMAILto overrideuser.email
Current Behavior
export OTEL_RESOURCE_ATTRIBUTES="user.email=me@example.com,deployment.environment=prod"
export CLAUDE_CODE_ENABLE_TELEMETRY=1
claude
# -> user.email is still N/A in telemetry
# -> deployment.environment is also missing
Expected Behavior
User-provided OTEL resource attributes should be included in telemetry output.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗