Skip to content

[RUM-15273] 🔊 Add telemetry for trackResourceHeaders#4492

Merged
bdibon merged 4 commits intomainfrom
boris.dibon/trackResourceHeaders-telemetry
Apr 21, 2026
Merged

[RUM-15273] 🔊 Add telemetry for trackResourceHeaders#4492
bdibon merged 4 commits intomainfrom
boris.dibon/trackResourceHeaders-telemetry

Conversation

@bdibon
Copy link
Copy Markdown
Contributor

@bdibon bdibon commented Apr 16, 2026

Motivation

We want to track how customers configure trackResourceHeaders (default preset vs custom array) to understand adoption patterns. This adds a use_track_resource_headers field to the telemetry configuration event.

Changes

  • Bump rum-events-format submodule for the new use_track_resource_headers telemetry configuration schema field
  • Regenerate telemetry event types
  • Add getTrackResourceHeadersTelemetryValue helper that maps the init configuration value:
    • trackResourceHeaders: true"default_headers"
    • trackResourceHeaders: [...] (array) → "custom"
    • undefined / false → omitted from the telemetry event
  • Wire the helper into serializeRumConfiguration

Test instructions

  1. Start the dev server:
yarn dev-server start
  1. Create sandbox/test-track-resource-headers-telemetry.html:
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Test trackResourceHeaders telemetry</title>
    <script src="/datadog-rum.js"></script>
    <script>
      DD_RUM.init({
        clientToken: 'xxx',
        applicationId: 'xxx',
        proxy: '/proxy',
        trackResourceHeaders: true,
      })
    </script>
  </head>
  <body>
    <p>trackResourceHeaders: true</p>
  </body>
</html>
  1. Open the page and flush events:
yarn dev-server intake clear
agent-browser open http://localhost:8081/test-track-resource-headers-telemetry.html
agent-browser tab new
  1. Verify the telemetry configuration event contains use_track_resource_headers: "default_headers":
yarn dev-server intake telemetry-configuration-events --format json | jq '.[0].telemetry.configuration.use_track_resource_headers'
# Expected: "default_headers"
  1. To test the custom case, change the init config to trackResourceHeaders: [{ name: 'x-custom' }], close the browser, clear intake, and repeat steps 3-4. Expected value: "custom".

  2. Clean up:

yarn dev-server stop
rm sandbox/test-track-resource-headers-telemetry.html

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

@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented Apr 16, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 50.00%
Overall Coverage: 77.02% (-0.02%)

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

@bdibon
Copy link
Copy Markdown
Contributor Author

bdibon commented Apr 16, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

@bdibon bdibon marked this pull request as ready for review April 16, 2026 14:11
@bdibon bdibon requested a review from a team as a code owner April 16, 2026 14:11
Comment thread packages/rum-core/src/domain/configuration/configuration.spec.ts Outdated
Comment thread packages/rum-core/src/domain/configuration/configuration.spec.ts Outdated
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

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

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 179.16 KiB 179.27 KiB +110 B +0.06%
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.00 KiB 135.11 KiB +110 B +0.08%
Worker 23.63 KiB 23.63 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
RUM - add global context 0.004 0.0045 +12.50%
RUM - add action 0.0133 0.0142 +6.77%
RUM - add error 0.0129 0.014 +8.53%
RUM - add timing 0.0028 0.0032 +14.29%
RUM - start view 0.0127 0.0187 +47.24%
RUM - start/stop session replay recording 0.0007 0.0007 0.00%
Logs - log message 0.0202 0.0161 -20.30%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 32.43 KiB 30.80 KiB -1.63 KiB
RUM - add action 105.60 KiB 100.17 KiB -5.43 KiB
RUM - add timing 31.89 KiB 32.60 KiB +734 B
RUM - add error 99.80 KiB 95.43 KiB -4.37 KiB
RUM - start/stop session replay recording 31.26 KiB 32.03 KiB +790 B
RUM - start view 507.19 KiB 488.86 KiB -18.33 KiB
Logs - log message 100.24 KiB 109.55 KiB +9.31 KiB

🔗 RealWorld

@bdibon bdibon requested a review from thomas-lebeau April 17, 2026 08:47
Comment thread packages/rum-core/src/domain/configuration/configuration.ts Outdated
Comment thread packages/rum-core/src/domain/configuration/configuration.spec.ts Outdated
Comment thread packages/rum-core/src/domain/configuration/configuration.spec.ts Outdated
bdibon added 3 commits April 20, 2026 13:19
- Bump rum-events-format submodule for telemetry configuration schema
- Regenerate telemetry and RUM event types
- Map trackResourceHeaders init value to default_headers or custom for telemetry
@bdibon bdibon force-pushed the boris.dibon/trackResourceHeaders-telemetry branch from 4dbbe2e to e6316c1 Compare April 20, 2026 11:59
@bdibon bdibon requested a review from thomas-lebeau April 20, 2026 12:01
Comment thread packages/rum-core/src/domain/configuration/configuration.ts Outdated
Comment thread AGENTS.md Outdated
@bdibon bdibon force-pushed the boris.dibon/trackResourceHeaders-telemetry branch from f6d1dfd to ac7366b Compare April 21, 2026 08:23
@bdibon bdibon requested a review from bcaudan April 21, 2026 08:23
@bdibon bdibon merged commit 68209b3 into main Apr 21, 2026
22 checks passed
@bdibon bdibon deleted the boris.dibon/trackResourceHeaders-telemetry branch April 21, 2026 12:47
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 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