[FEATURE] support TRACEPARENT context propagation for OpenTelemetry
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
We use opentelemetry to expose metrics, logs and traces of our developer environments and github action workflows. All our developer environments have a TRACEPARENT= environment variable set (https://opentelemetry.io/docs/specs/otel/context/env-carriers/)
that tracks the trace for a certain shell session.
We want to enable Claude Code's telemetry integration (https://code.claude.com/docs/en/monitoring-usage)
but we want it to integrate with our existing telemetry stack; so that we can correlate claude code sessions to the developer environments that they're spawned in
Proposed Solution
claude should read the TRACEPARENT= env var and use that to set the traceId and spanId field on the log records, and the span_id and trace_id examplars on the metric events, so that telemetry that claude generates can be correlated to the trace/span in which they were generated.
Alternative Solutions
None
Priority
High - Significant impact on productivity
Feature Category
Developer tools/SDK
Use Case Example
_No response_
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗