[tracing] Assert that OTLP spans have full 128-bit trace IDs#6973
Merged
Conversation
…it_trace_id_consistent_across_spans to validate that implementations export all OTLP spans with the full 128-bit trace ID. This was identified as an issue in the libdatadog implementation
Contributor
|
|
Contributor
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 3112fa1 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 507f2ee3e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ZStriker19
approved these changes
May 28, 2026
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
to DataDog/libdatadog
that referenced
this pull request
May 29, 2026
# What does this PR do? This PR updates the conversion of DD spans to OTLP spans to ensure all spans receive the high 64 bits of the 128-bit trace ID. DD tracers set `_dd.p.tid` (high 64 bits of 128-bit trace ID) only on the chunk root per RFC #85 — the Datadog backend reconstructs the full 128-bit ID at ingest. The OTLP mapper previously only read the tag per span, so child spans were emitted with upper 64 bits zeroed and traces fragmented in pure-OTel backends. The approach determines the chunk-level `_dd.p.tid` once in `map_traces_to_otlp` and applies it to every span in the chunk. Per-span value still wins (forward-compat with tracers that propagate everywhere). Use `find_map` over the chunk so a malformed root tag falls back to the first parseable value in the chunk rather than poisoning the whole trace. # Motivation Performing end-to-end tests with dd-trace-py exporting OTLP spans surfaced this issue, which results in child spans recording different trace IDs than the local root spans. Notably, the only difference was that the high 64-bits of the 128-bit trace ID were zero'ed out. # Additional Notes A system-test to cover this scenario is being simultaneously added in DataDog/system-tests#6973 # How to test the change? Regression tests have been added to `libdd-trace-utils/src/otlp_encoder/mapper.rs`. Co-authored-by: zach.montoya <zach.montoya@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
End-to-end testing identified that traces exported as OTLP by dd-trace-py had incorrect trace IDs. The HTTP server span had a 128-bit trace ID while its child spans had that same trace ID except the upper 64 bits were zeroed out. This test will ensure that we track and remediate this behavior across all languages.
Changes
Add
test/otel_test_tracing_otlp.py::Test_Otel_Tracing_OTLP::test_128bit_trace_id_consistent_across_spansto validate that implementations export all OTLP spans with the full 128-bit trace ID. This was identified as an issue in the libdatadog implementationWorkflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present