Skip to content

✨ implement remote configuration async loading & caching#4606

Open
gogusarov wants to merge 4 commits into
mainfrom
grigory.gusarov/RUM-15992
Open

✨ implement remote configuration async loading & caching#4606
gogusarov wants to merge 4 commits into
mainfrom
grigory.gusarov/RUM-15992

Conversation

@gogusarov
Copy link
Copy Markdown
Contributor

@gogusarov gogusarov commented May 11, 2026

Motivation

Support remote configuration asynchronous loading & caching mechanism according to the RFC

Changes

Added async remote configuration fetching flow where config isn't awaited during DD_RUM.init but read synchronously from a versioned localStorage cache (dd_rc_<remoteConfigurationId>) and applied on the same page load. A background fetch runs in parallel and refreshes the cache for the next page load, so updates roll out one load late but startup is unblocked. Cache outcomes (hit/miss/error) and fetch outcomes (success/failure) are reported via the existing telemetry metrics. Unit tests cover the new cache module and the read/apply/fetch flow; the e2e scenarios were rewritten to wait for the cache to be populated and reload the page before asserting.

Blocking fetch flow was kept for backward compatibility with existing customer setup

New init configuration API

  • remoteConfiguration: { id: string; sync?: boolean } — new top-level field.
    Default behavior is async (cache-and-reload). Pass sync: true to opt into the
    legacy blocking fetch through the new API.
  • remoteConfigurationId: string — legacy field preserved for backward
    compatibility with existing customer setups. Always triggers the blocking fetch
    flow.

Test instructions

  1. add remote-config.json file to sandbox directory
  2. update parameters, passed to DD_RUM.init adding remoteConfiguration: { id: 'remote-config-test' }, remoteConfigurationProxy: '/remote-config.json'
  3. check that remote config from file is requested and written to localStorage on the first page load (localStorage.getItem('dd_rc_remote-config-test')
  4. check that DD_RUM.getInitConfiguration() returns initial configuration on the first page load
  5. check that DD_RUM.getInitConfiguration() returns remote configuration on the second page load

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-prod-us1-6
Copy link
Copy Markdown

datadog-prod-us1-6 Bot commented May 11, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 79.63%
Overall Coverage: 76.97% (+0.01%)

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

Comment thread packages/rum-core/src/domain/configuration/remoteConfiguration.ts
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented May 12, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 169.51 KiB 170.76 KiB +1.25 KiB +0.74%
Rum Profiler N/A 5.97 KiB N/A N/A N/A
Rum Recorder 21.23 KiB 21.23 KiB -1 B -0.00%
Logs 54.70 KiB 54.70 KiB 0 B 0.00%
Rum Slim N/A 129.08 KiB N/A N/A N/A
Worker 22.99 KiB 22.99 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base CPU Time (ms) Local CPU Time (ms) 𝚫%
addglobalcontext N/A 0.0033 N/A
RUM - add action 0.0104 0.017 +63.46%
RUM - add error 0.0126 0.016 +26.98%
addtiming N/A 0.0009 N/A
RUM - start view 0.0109 0.0154 +41.28%
RUM - start/stop session replay recording 0.0008 0.0013 +62.50%
Logs - log message 0.0176 0.0257 +46.02%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 42.69 KiB 38.29 KiB -4.40 KiB
RUM - add action 67.95 KiB 63.47 KiB -4.48 KiB
RUM - add timing 37.49 KiB 38.42 KiB +953 B
RUM - add error 73.15 KiB 70.27 KiB -2.88 KiB
RUM - start/stop session replay recording 41.06 KiB 41.81 KiB +768 B
RUM - start view 492.59 KiB 483.80 KiB -8.79 KiB
Logs - log message 55.59 KiB 55.34 KiB -256 B

🔗 RealWorld

@gogusarov gogusarov force-pushed the grigory.gusarov/RUM-15992 branch from 8a5af9b to 5bef505 Compare May 12, 2026 17:04
Comment thread test/e2e/scenario/rum/remoteConfiguration.scenario.ts Outdated
@gogusarov gogusarov marked this pull request as ready for review May 13, 2026 12:22
@gogusarov gogusarov requested a review from a team as a code owner May 13, 2026 12:22
Comment thread test/e2e/scenario/rum/remoteConfiguration.scenario.ts Outdated
@thomas-lebeau
Copy link
Copy Markdown
Collaborator

can you edit the PR title to follow our convention please!

@gogusarov gogusarov changed the title feat: implement remote configuration caching mechanism ✨ implement remote configuration caching mechanism May 14, 2026
@gogusarov gogusarov force-pushed the grigory.gusarov/RUM-15992 branch from 2a0d867 to 3c37331 Compare May 14, 2026 17:41
@gogusarov gogusarov force-pushed the grigory.gusarov/RUM-15992 branch from 3c37331 to df72f91 Compare May 14, 2026 17:48
@gogusarov gogusarov changed the title ✨ implement remote configuration caching mechanism ✨ implement remote configuration async loading & caching May 14, 2026
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.

3 participants