Skip to content

Comments

💥 enable propagateTraceBaggage by default#4226

Merged
BenoitZugmeyer merged 2 commits intov7from
benoit/propagate-trace-baggage-by-default
Feb 23, 2026
Merged

💥 enable propagateTraceBaggage by default#4226
BenoitZugmeyer merged 2 commits intov7from
benoit/propagate-trace-baggage-by-default

Conversation

@BenoitZugmeyer
Copy link
Member

Motivation

The baggage header propagates RUM session context (session ID, user ID, account ID) to backend services for distributed tracing correlation. Requiring customers to explicitly opt in creates unnecessary friction — it should be on by default, with an explicit opt-out for those who don't want it.

Changes

  • configuration.ts: change default from false to true by using !== false instead of !!
  • tracer.spec.ts: update expected headers to include baggage by default; use toPlainObject() for the Request case to avoid alphabetical ordering sensitivity
  • tracing.scenario.ts: update e2e scenarios — baggage is now expected in checkRequestHeaders by default, rename the old "propagate trace baggage" test to cover user/account specifically, add a new test for propagateTraceBaggage: false

Test instructions

  1. Open the sandbox (yarn dev, navigate to http://localhost:8080)
  2. Add allowedTracingUrls: ['https://httpbin.org'], service: 'sandbox' to DD_RUM.init() in sandbox/index.html
  3. Run fetch('https://httpbin.org/headers').then(r => r.json()).then(j => console.log(j.headers)) — verify Baggage: session.id=... is present
  4. Add propagateTraceBaggage: false — reload and repeat — verify Baggage is absent

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review February 23, 2026 14:36
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner February 23, 2026 14:36
@cit-pr-commenter-54b7da
Copy link

cit-pr-commenter-54b7da bot commented Feb 23, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 170.61 KiB 170.61 KiB +3 B +0.00%
Rum Profiler 4.69 KiB 4.69 KiB 0 B 0.00%
Rum Recorder 24.91 KiB 24.91 KiB 0 B 0.00%
Logs 56.38 KiB 56.38 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 127.89 KiB 127.89 KiB +3 B +0.00%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance

Pending...

🧠 Memory Performance

Pending...

🔗 RealWorld

@datadog-official
Copy link

datadog-official bot commented Feb 23, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 76.96% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 001e331 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/propagate-trace-baggage-by-default branch from a01f4bf to 001e331 Compare February 23, 2026 14:54
Comment on lines +97 to 114
createTest('do not propagate trace baggage when disabled')
.withRum({
service: 'service',
allowedTracingUrls: ['LOCATION_ORIGIN'],
propagateTraceBaggage: false,
})
.run(async ({ intakeRegistry, flushEvents, page }) => {
const rawHeaders = await page.evaluate(() =>
window
.fetch('/headers')
.then((response) => response.text())
.catch(() => new Error('Fetch request failed!'))
)
const headers = parseHeaders(rawHeaders)
checkRequestHeaders(headers, { withBaggage: false })
await flushEvents()
checkTraceAssociatedToRumEvent(intakeRegistry)
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ question: ‏what happen when:

  • propagateTraceBaggage: true and no user and account context set?
  • propagateTraceBaggage: false and user and account context is set

should we also test for these?

Copy link
Member Author

Choose a reason for hiding this comment

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

  • propagateTraceBaggage: true and no user and account context set?

This is already covered by various test cases, since propagateTraceBaggage: true is the default now. This assertion ensure the baggage header is set with the session id.

  • propagateTraceBaggage: false and user and account context is set

I don't think we really need to test for it, since in this case the header should just not be present?

@BenoitZugmeyer BenoitZugmeyer merged commit 8fc233a into v7 Feb 23, 2026
19 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/propagate-trace-baggage-by-default branch February 23, 2026 19:31
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants