You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Way to add baggage as tags via environment variable OR system properties #4975
Is there a way to map baggage as tags via environment variable OR system properties? I know that it can be done via span.getBaggageItem and span.setBaggageItem, but is there a service level or global property which can be set like DD_TRACE_BAGGAGE_TAGS, which will accept baggage-key:span-key where it will check if a span has the baggageItem called baggage-key and create a span tag with that baggage item.
Why i would want this is, because we have a key called as taskId which gets generated early on for a task run, and i want all the spans searchable by that taskId, meaning i want taskId available throughout the trace. I know that i can add baggageItem, but baggageItems are not sent to datadog. Also, doing getBaggageItem everywhere in the code is cumbersome process.
Hello! Thanks for raising this issue, and sorry for the delayed response.
We introduced a new configuration, DD_TRACE_BAGGAGE_TAG_KEYS, which allows you to declare baggage keys that should automatically be copied onto spans as tags. When a span contains a baggage item matching one of the configured keys, its value is added to a span as a tag in the form baggage.: .
This functionality was implemented in the Java tracer in this PR
if you’d like to take a closer look.
I hope this helps with your use case. Thank you again!
Activity
umarkhan17 commentedon Mar 28, 2023
Just like how we can map headers to tags with this DD_TRACE_HEADER_TAGS, i want to map baggage to tags.
rachelyangdog commentedon Feb 5, 2026
Hello! Thanks for raising this issue, and sorry for the delayed response.
We introduced a new configuration,
DD_TRACE_BAGGAGE_TAG_KEYS, which allows you to declare baggage keys that should automatically be copied onto spans as tags. When a span contains a baggage item matching one of the configured keys, its value is added to a span as a tag in the form baggage.: .This functionality was implemented in the Java tracer in this PR
if you’d like to take a closer look.
I hope this helps with your use case. Thank you again!