⚗️ Add 128-bit trace IDs for Browser RUM - #4926
Draft
BeltranBulbarellaDD wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
@codex pls review |
Bundles Sizes Evolution
|
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 26b264f | Docs | Datadog PR Page | Give us feedback! |
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.
Draft: waiting for approval on the RFC.
Motivation
Browser RUM currently generates 64-bit trace IDs and stores them as decimal on resource events. APM, mobile SDKs, and LLM Observability use 128-bit hexadecimal IDs, so Browser-started traces cannot be joined through one shared representation without extracting the low 64 bits and converting it to hexadecimal.
This PR introduces 128-bit trace IDs behind the
trace_id_128_bitexperimental feature. The existing 64-bit behavior remains the default while we dogfood and validate end-to-end correlation and CORS behavior.Changes
<32-bit Unix timestamp><32 zero bits><64 random bits>.toString()behavior.trace_id_128_bitis enabled:x-datadog-trace-idas the low 64 bits in decimal;x-datadog-tags: _dd.p.tid=<high 64 bits in hex>;traceparent, B3, and B3 multi headers;_dd.trace_idon RUM resource events as a 32-character lowercase hexadecimal string.x-datadog-tagsheader and the tracecontext-only fallback.Enable it with:
Example from manual testing:
6a6ca9f1000000000d5e267e2ee09948_dd.p.tid)6a6ca9f100000000x-datadog-trace-id)9632496936980708566901709716850828458The full trace ID is the concatenation of the high 64-bit hex value and the low 64 bits converted to 16-character hexadecimal.
Playground
Screenshots:

link of the example trace in DD
Test instructions
Build and serve the local Browser SDK, then override the Playground SDK with the developer extension.
Initialize RUM with:
{ "applicationId": "<application-id>", "clientToken": "<client-token>", "site": "datadoghq.com", "service": "browser-sdk-128bit-local", "allowedTracingUrls": ["https://datadoghq.dev"], "enableExperimentalFeatures": ["trace_id_128_bit"] }Trigger a traced fetch or XHR request.
Verify that:
traceparentcontains a non-zero 32-character trace ID;x-datadog-tagscontains_dd.p.tidmatching the first 16 characters oftraceparent;x-datadog-trace-idremains a decimal representation of the low 64 bits;For cross-origin Datadog propagation, allow
x-datadog-tagsinAccess-Control-Allow-Headers; otherwise the browser preflight is expected to fail.Checklist