Skip to content

[tracing] Assert that OTLP spans have full 128-bit trace IDs#6973

Merged
zacharycmontoya merged 4 commits into
mainfrom
zach.montoya/otlp-trace-id-test
Jun 2, 2026
Merged

[tracing] Assert that OTLP spans have full 128-bit trace IDs#6973
zacharycmontoya merged 4 commits into
mainfrom
zach.montoya/otlp-trace-id-test

Conversation

@zacharycmontoya

Copy link
Copy Markdown
Contributor

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_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

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

…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
@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
tests/otel/test_tracing_otlp.py                                         @DataDog/system-tests-core
utils/interfaces/_open_telemetry.py                                     @DataDog/system-tests-core

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3112fa1 | Docs | Datadog PR Page | Give us feedback!

@zacharycmontoya zacharycmontoya marked this pull request as ready for review May 27, 2026 22:28
@zacharycmontoya zacharycmontoya requested review from a team as code owners May 27, 2026 22:28
@zacharycmontoya zacharycmontoya requested review from ZStriker19 and duncanista and removed request for a team May 27, 2026 22:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread utils/interfaces/_open_telemetry.py Outdated
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>
@zacharycmontoya zacharycmontoya merged commit e7d64a2 into main Jun 2, 2026
2665 of 2670 checks passed
@zacharycmontoya zacharycmontoya deleted the zach.montoya/otlp-trace-id-test branch June 2, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants