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
fix(tracing): avoid truncating b3 and w3c trace ids to 64bits (#5509)
Builds on: #5434
Previously the trace id in b3 and w3c trace headers were truncated from
128 bits to 64 bits if
`DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED=False`. This behavior is
incorrect.
The trace ids in b3 and w3c headers should NEVER be truncated.
Note - This PR does not require a release note. It is a fix for an
[unreleased](a1e27bb)
change.
Note - A regression test is not required. This issue was detected by
system-tests:
[ex](https://github.com/DataDog/system-tests/blob/6168fa7e6f485e2655f81801a677356624409620/parametric/test_128_bit_traceids.py#L230).
### Background
The implementation of 128 bit trace ids is compatible with all versions
of the agent. Trace ids are always sent to the agent as 64 bits (ex:
[v05
encoder](https://github.com/DataDog/dd-trace-py/blob/v1.11.2/ddtrace/internal/_encoding.pyx#L721)).
The higher order bits are stored in a tag in the
[tracetagsprocessor](https://github.com/DataDog/dd-trace-py/blob/v1.11.2/ddtrace/internal/processor/trace.py#L136).
- If the datadog agent only support 64bit trace ids, the agent will
ignore the tag and the original 128 bit trace id will be truncated to
64bits. This preserves the current behavior.
- If the datadog agent supports 128bit trace ids the agent will
reconstruct the full 128 bit trace id using the encoded trace_id field
and the _dd.p.tid tag.
## Checklist
- [x] Change(s) are motivated and described in the PR description.
- [x] Testing strategy is described if automated tests are not included
in the PR.
- [x] Risk is outlined (performance impact, potential for breakage,
maintainability, etc).
- [x] Change is maintainable (easy to change, telemetry, documentation).
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines)
are followed.
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/)).
- [x] PR description includes explicit acknowledgement/acceptance of the
performance implications of this PR as reported in the benchmarks PR
comment.
## Reviewer Checklist
- [ ] Title is accurate.
- [ ] No unnecessary changes are introduced.
- [ ] Description motivates each change.
- [ ] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes unless absolutely necessary.
- [ ] Testing strategy adequately addresses listed risk(s).
- [ ] Change is maintainable (easy to change, telemetry, documentation).
- [ ] Release note makes sense to a user of the library.
- [ ] Reviewer has explicitly acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment.
0 commit comments