dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

Baggage injected via DD_TRACE_HEADER_BAGGAGE is not retrievable via OTEL Baggage API

Open Xyaren opened this issue 1 month ago • 1 comments

Tracer Version(s)

1.56.1~b8849a9451

Java Version(s)

21.0.9

JVM Vendor

Eclipse Adoptium / Temurin

Bug Report

Baggage mapped into the trace baggage via DD_TRACE_HEADER_BAGGAGE is not retrievable via OTEL Context.

Expected Behavior

I expect OTEL Baggage to be the same as Datadog Internal Tracer Baggage

Reproduction Code

ENV:

DD_ENV=dev
DD_INTEGRATIONS_ENABLED=true
DD_REMOTE_CONFIGURATION_ENABLED=false
DD_SERVICE=example
DD_SERVICE_NAME=example
DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED=false
DD_TRACE_DEBUG=true
DD_TRACE_HEADER_BAGGAGE=comp-business-process-id:company.businessProcessId,comp-business-process-name:company.businessProcessName
DD_TRACE_OTEL_ENABLED=true

HTTP Call with headers:

GET http://localhost:8504/client
comp-business-process-id: this-is-a-bpid-keep-it
comp-business-process-name: this-is-a-bpid-name-keep-it

Retrieving baggas as map should contain the mentioned properties.

Baggage.current().asMap()

Xyaren avatar Nov 25 '25 16:11 Xyaren

Hi @Xyaren - currently the DD_TRACE_HEADER_BAGGAGE config setting only applies to the non-W3C baggage representation. It doesn't apply to the W3C baggage representation that is surfaced via the OTel API.

We'd need to consider how best to support DD_TRACE_HEADER_BAGGAGE with W3C baggage that doesn't result in duplication across W3C and the old headers.

mcculls avatar Nov 25 '25 17:11 mcculls