Skip to content

[RUM-15280] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RumPublicApi#4523

Merged
bdibon merged 4 commits intomainfrom
boris.dibon/trackResourceHeaders-dogfood-feedback
Apr 28, 2026
Merged

[RUM-15280] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RumPublicApi#4523
bdibon merged 4 commits intomainfrom
boris.dibon/trackResourceHeaders-dogfood-feedback

Conversation

@bdibon
Copy link
Copy Markdown
Contributor

@bdibon bdibon commented Apr 23, 2026

Motivation

Dogfooding feedback on trackResourceHeaders: customers using the CDN bundle have no runtime access to the default header list, so they can't extend it (e.g. [...defaults, 'x-my-header']) without hardcoding. Named exports from entries/main.ts reach NPM users but not the window.DD_RUM global, so the constant needs to be attached to the public API object itself.

Changes

  • Expose DEFAULT_TRACKED_RESOURCE_HEADERS as a property on RumPublicApi (marked @hidden for now), so CDN users can access it as window.DD_RUM.DEFAULT_TRACKED_RESOURCE_HEADERS.
  • Update the trackResourceHeaders JSDoc example in RumInitConfiguration to use ...DEFAULT_TRACKED_RESOURCE_HEADERS.map((h) => ({ name: h })) instead of the name: (h) => ...includes(h) predicate form — matches how customers actually want to extend the defaults.

Note: this introduces a non-function, non-state property on RumPublicApi for the first time; every other member is either a method, a ContextManager, initConfiguration, or version.

Test instructions

  1. Check out the branch and run yarn build (or yarn dev).
  2. Load the sandbox page with the CDN bundle in a browser.
  3. In DevTools console, run:
    window.DD_RUM.DEFAULT_TRACKED_RESOURCE_HEADERS
    Expect the array ['cache-control', 'etag', 'age', 'expires', 'content-type', 'content-encoding', 'vary', 'content-length', 'server-timing', 'x-cache'].
  4. Verify it can be used to extend the config:
    window.DD_RUM.init({
      applicationId: '<APP_ID>',
      clientToken: '<CLIENT_TOKEN>',
      trackResourceHeaders: [
        ...window.DD_RUM.DEFAULT_TRACKED_RESOURCE_HEADERS.map((h) => ({ name: h })),
        { name: 'x-request-id' },
      ],
    })
    and that a resource event carries the expected headers.

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

@bdibon bdibon changed the title [RUM-15273] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RUM public API [RUM-15280] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RUM public API Apr 23, 2026
@bdibon bdibon changed the title [RUM-15280] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RUM public API [RUM-15280] ✨ Expose DEFAULT_TRACKED_RESOURCE_HEADERS on RumPublicApi Apr 23, 2026
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Apr 23, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 179.27 KiB 179.27 KiB +2 B +0.00%
Rum Profiler 6.16 KiB 6.16 KiB 0 B 0.00%
Rum Recorder 27.03 KiB 27.03 KiB 0 B 0.00%
Logs 56.65 KiB 56.65 KiB 0 B 0.00%
Rum Slim 135.11 KiB 135.14 KiB +32 B +0.02%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance

Pending...

🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 32.86 KiB 32.03 KiB -847 B
RUM - add action 105.90 KiB 100.44 KiB -5.45 KiB
RUM - add timing 31.38 KiB 32.01 KiB +645 B
RUM - add error 103.00 KiB 93.54 KiB -9.45 KiB
RUM - start/stop session replay recording 31.12 KiB 32.44 KiB +1.32 KiB
RUM - start view 494.41 KiB 487.89 KiB -6.52 KiB
Logs - log message 95.78 KiB 102.68 KiB +6.90 KiB

🔗 RealWorld

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented Apr 23, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.02% (-0.01%)

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

@bdibon bdibon marked this pull request as ready for review April 23, 2026 14:23
@bdibon bdibon requested a review from a team as a code owner April 23, 2026 14:23
Comment thread packages/rum-core/src/boot/rumPublicApi.ts Outdated
Comment thread packages/rum-core/src/boot/rumPublicApi.ts
Comment thread packages/rum-core/src/domain/configuration/configuration.ts
Comment thread packages/rum-core/src/domain/configuration/configuration.ts
@bdibon bdibon force-pushed the boris.dibon/trackResourceHeaders-dogfood-feedback branch from 48c4ff5 to ad4e560 Compare April 27, 2026 09:52
@bdibon bdibon requested a review from bcaudan April 27, 2026 09:52
@bdibon bdibon merged commit 5982807 into main Apr 28, 2026
21 checks passed
@bdibon bdibon deleted the boris.dibon/trackResourceHeaders-dogfood-feedback branch April 28, 2026 11:58
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 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