Skip to content

🔥 Extract remote configuration logic into standalone package#4001

Draft
mormubis wants to merge 2 commits intomainfrom
adlrb/ssi
Draft

🔥 Extract remote configuration logic into standalone package#4001
mormubis wants to merge 2 commits intomainfrom
adlrb/ssi

Conversation

@mormubis
Copy link
Contributor

@mormubis mormubis commented Dec 5, 2025

Summary

Extracts remote configuration fetching and parsing logic from rum-core into a new standalone package @datadog/browser-remote-config, enabling customers to use remote config independently of the RUM SDK.

This is a breaking change appropriate for v7 major version.

Key Changes

New Package: @datadog/browser-remote-config

Public API:

  • fetchRemoteConfiguration(options) - Fetch remote config from Datadog
  • buildEndpoint(options) - Construct endpoint URLs
  • resolveDynamicValues(configValue, options) - Resolve dynamic values (cookies, DOM, JS paths)
  • parseJsonPath(path) - Parse JSON paths for JS resolution
  • Full TypeScript support with comprehensive type exports

Features:

  • Lightweight package with only @datadog/browser-core dependency
  • Support for dynamic value resolution (cookies, DOM selectors, JS paths)
  • Regex extraction for value filtering
  • 67 comprehensive unit tests covering all scenarios
  • Full documentation with usage examples

Changes to rum-core

Removed:

  • remoteConfiguration.ts - moved to remote-config
  • remoteConfiguration.types.ts - moved to remote-config
  • jsonPathParser.ts - moved to remote-config
  • All remote configuration tests (moved and adapted)

Modified:

  • Removed remoteConfigurationId and remoteConfigurationProxy from RumInitConfiguration
  • Simplified preStartRum.ts - no more async remote config fetch
  • SDK now initializes directly without remote config fetching

Migration Guide

Old pattern (v6):

datadogRum.init({
  applicationId: 'app123',
  remoteConfigurationId: '0e008b1b-8600-4709-9d1d-f4edcfdf5587'
})

New pattern (v7):

import { fetchRemoteConfiguration } from '@datadog/browser-remote-config'

const remoteConfig = await fetchRemoteConfiguration({
  applicationId: 'app123',
  remoteConfigurationId: '0e008b1b-8600-4709-9d1d-f4edcfdf5587'
})

const config = {
  applicationId: 'app123',
  clientToken: 'xxx',
  // ... other config
}

if (remoteConfig.ok && remoteConfig.value?.rum) {
  Object.assign(config, remoteConfig.value.rum)
}

datadogRum.init(config)

Benefits

Decoupling: Customers can use remote config independently
Simplicity: SDK no longer handles async remote config fetch
Flexibility: Enables parallel fetching and custom initialization
Lightweight: SDK is simpler and lighter
Reusability: Remote config package works with any RUM-compatible SDK

Test Results

  • ✅ 3153 unit tests pass (includes 67 new remote-config tests)
  • ✅ TypeScript strict mode compilation passes
  • ✅ Full workspace build succeeds
  • ✅ Zero circular dependencies
  • ✅ Package automatically registered in Yarn workspaces

Files Changed

New files:

  • packages/remote-config/ - Complete new package
    • src/remoteConfiguration.ts - Core fetch and resolve logic
    • src/remoteConfiguration.types.ts - Type definitions
    • src/jsonPathParser.ts - JSON path parsing
    • src/index.ts - Public API exports
    • src/remoteConfiguration.spec.ts - Tests (67 tests)
    • src/jsonPathParser.spec.ts - Parser tests
    • package.json - Package configuration
    • README.md - Documentation with usage examples

Modified files:

  • packages/rum-core/ - Removed remote config logic and tests
  • test/e2e/ - Updated test framework to remove RemoteConfiguration type dependency
  • test/e2e/scenario/rum/remoteConfiguration.scenario.ts - Disabled (functionality moved to standalone package)

Test Plan

  • All 3153 unit tests pass
  • TypeScript compilation succeeds in strict mode
  • Full workspace build succeeds
  • New remote-config package exports work correctly
  • Dynamic value resolution tested (67 test cases)
  • Endpoint construction tested
  • Error handling tested
  • Backward compatibility verified (SDK works without remote config)

🤖 Generated with Claude Code

@cit-pr-commenter
Copy link

cit-pr-commenter bot commented Dec 5, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 167.98 KiB 163.42 KiB -4.56 KiB -2.71%
Rum Profiler 4.31 KiB 4.31 KiB +1 B +0.02%
Rum Recorder 24.54 KiB 24.54 KiB +1 B +0.00%
Logs 56.25 KiB 56.25 KiB 0 B 0.00%
Flagging 944 B 944 B 0 B 0.00%
Rum Slim 124.88 KiB 120.44 KiB -4.44 KiB -3.55%
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.0039 0.0053 +35.90%
RUM - add action 0.0129 0.0165 +27.91%
RUM - add error 0.0133 0.0196 +47.37%
RUM - add timing 0.0026 0.004 +53.85%
RUM - start view 0.0031 0.0035 +12.90%
RUM - start/stop session replay recording 0.0007 0.0009 +28.57%
Logs - log message 0.0176 0.0197 +11.93%
🧠 Memory Performance
Action Name Base Memory Consumption Local Memory Consumption 𝚫
RUM - add global context 28.70 KiB 28.43 KiB -269 B
RUM - add action 100.44 KiB 96.62 KiB -3.82 KiB
RUM - add timing 27.83 KiB 26.29 KiB -1.54 KiB
RUM - add error 102.86 KiB 105.11 KiB +2.25 KiB
RUM - start/stop session replay recording 26.75 KiB 29.31 KiB +2.56 KiB
RUM - start view 438.38 KiB 442.10 KiB +3.71 KiB
Logs - log message 48.20 KiB 47.47 KiB -747 B

🔗 RealWorld

@datadog-official
Copy link

datadog-official bot commented Dec 5, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 75.27%
Overall Coverage: 77.18% (-0.07%)

View detailed report

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

Claude Code and others added 2 commits February 2, 2026 17:39
- STACK.md - Technologies and dependencies
- ARCHITECTURE.md - System design and patterns
- STRUCTURE.md - Directory layout
- CONVENTIONS.md - Code style and patterns
- TESTING.md - Test structure
- INTEGRATIONS.md - External services
- CONCERNS.md - Technical debt and issues
Creates new @datadog/browser-remote-config package with:
- Independent remote configuration fetching and parsing
- Support for dynamic value resolution (cookies, DOM, JS paths)
- Lightweight package with only @datadog/browser-core dependency
- Comprehensive unit and integration tests (67 passing tests)
- Full TypeScript support with strict mode

Removes remote configuration from rum-core:
- Removes remoteConfigurationId and remoteConfigurationProxy from SDK init
- Removes async remote config fetch from bootstrap
- Simplifies SDK initialization flow
- Enables parallel fetching/initialization by customers

Benefits:
- Customers can use remote config independently of RUM SDK
- SDK is simpler and lighter
- Clear separation of concerns
- Enables parallel fetching/initialization strategies

This is a breaking change appropriate for v7 major version.

Customers migrating from v6 to v7:
- Old: datadogRum.init({ remoteConfigurationId: 'xxx' })
- New: const cfg = await fetchRemoteConfiguration(...); datadogRum.init({ ...cfg.value?.rum })

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@mormubis mormubis changed the title ✨ ssi 🔥 Extract remote configuration logic into standalone package Feb 4, 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.

1 participant