From 301366dc76b544218d43bb170644be558c0992c1 Mon Sep 17 00:00:00 2001 From: Leo Romanovsky Date: Fri, 7 Aug 2026 15:22:11 +0000 Subject: [PATCH 1/4] Document client RUM context integration --- hugo/config/_default/menus/main.en.yaml | 5 + .../content/en/feature_flags/client/_index.md | 4 + .../feature_flags/client/rum_integration.md | 117 ++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 hugo/content/en/feature_flags/client/rum_integration.md diff --git a/hugo/config/_default/menus/main.en.yaml b/hugo/config/_default/menus/main.en.yaml index 6b4e4bc7782..57c43145339 100644 --- a/hugo/config/_default/menus/main.en.yaml +++ b/hugo/config/_default/menus/main.en.yaml @@ -6367,6 +6367,11 @@ menu: parent: feature_flags_client identifier: feature_flags_client_unity weight: 108 + - name: RUM Integration + url: feature_flags/client/rum_integration + parent: feature_flags_client + identifier: feature_flags_client_rum_integration + weight: 109 - name: Server SDKs url: feature_flags/server parent: feature_flags diff --git a/hugo/content/en/feature_flags/client/_index.md b/hugo/content/en/feature_flags/client/_index.md index 97c37e1860d..81aa262d8fb 100644 --- a/hugo/content/en/feature_flags/client/_index.md +++ b/hugo/content/en/feature_flags/client/_index.md @@ -73,6 +73,8 @@ Default: `true`. Set to `false` to disable. - **React Native**: `rumIntegrationEnabled` - **Unity**: Not exposed +RUM integration can also use the current RUM user as defaults for feature flag evaluation context. For attribute mapping, precedence, user changes, and opt-out behavior, see [RUM Integration][1]. + ## Testing with in-memory providers Datadog supports these testing approaches: @@ -126,3 +128,5 @@ const evaluationContext = { For percentage-based rollouts and deterministic bucketing, see [Traffic Splitting and Randomization](/feature_flags/concepts/traffic_splitting/). {{< partial name="whats-next/whats-next.html" >}} + +[1]: /feature_flags/client/rum_integration/ diff --git a/hugo/content/en/feature_flags/client/rum_integration.md b/hugo/content/en/feature_flags/client/rum_integration.md new file mode 100644 index 00000000000..6a199d059b5 --- /dev/null +++ b/hugo/content/en/feature_flags/client/rum_integration.md @@ -0,0 +1,117 @@ +--- +title: RUM Integration +description: Use RUM user attributes in feature flag evaluation context and add flag evaluations to RUM events. +further_reading: +- link: "/feature_flags/client/" + tag: "Documentation" + text: "Client-Side Feature Flags" +- link: "/real_user_monitoring/feature_flag_tracking/" + tag: "Documentation" + text: "RUM Feature Flag Tracking" +- link: "https://openfeature.dev/docs/reference/concepts/evaluation-context/" + tag: "External" + text: "OpenFeature Evaluation Context" +--- + +## Overview + +Datadog client Feature Flags SDKs can integrate with Real User Monitoring (RUM) in two ways: + +- Use the current RUM user as default values for the feature flag evaluation context. +- Add feature flag evaluation results to RUM events for analysis in RUM Feature Flag Tracking. + +RUM integration availability and configuration depend on the platform and SDK version. See the [client SDK guide][1] for your platform. + +## Use RUM user context for flag evaluation + +When RUM user context integration is enabled, the Feature Flags provider reads the RUM user when the provider initializes or reconciles an evaluation context. The provider combines the RUM user with context explicitly supplied through OpenFeature: + +| RUM user data | Evaluation context behavior | +|---|---| +| User ID | Supplies the `targetingKey` when the OpenFeature context does not define one. | +| Flat string, number, and Boolean user attributes | Supply evaluation attributes when the OpenFeature context does not define attributes with the same names. | +| Nested objects, arrays, `null`, and other values | Are not added to the evaluation context. | + +The provider does not recursively flatten nested values. Some RUM user APIs store custom attributes in a container such as `extraInfo`. In those SDKs, the provider copies supported primitive entries from the container and excludes nested values. + +Fields explicitly supplied through OpenFeature take precedence over fields from the RUM user. This lets the application override a RUM value for feature flag targeting without changing the RUM user. + +An online provider uses the effective context for assignment requests, flag evaluation, exposure events, and evaluation telemetry. This keeps targeting and telemetry associated with the same subject. Precomputed and offline provider behavior depends on the platform because a configuration can be bound to a specific context. + +### Set the RUM user before the provider + +Set the RUM user before registering the Feature Flags provider. This lets the provider use the RUM user for its initial assignment request. + +{{< tabs >}} +{{% tab "Browser" %}} + +```javascript +DD_RUM.setUser({ + id: 'user-123', + email: 'user@example.com', + plan: 'premium', +}) + +await OpenFeature.setProviderAndWait(new DatadogProvider(configuration)) +``` + +{{% /tab %}} +{{% tab "React Native" %}} + +```tsx +await DdSdkReactNative.setUserInfo({ + id: 'user-123', + email: 'user@example.com', + extraInfo: { plan: 'premium' }, +}) + +await OpenFeature.setProviderAndWait(new DatadogOpenFeatureProvider()) +``` + +{{% /tab %}} +{{< /tabs >}} + +### Reconcile context after the RUM user changes + +Changing the RUM user after provider initialization does not automatically change the effective evaluation context. After a login, logout, or account switch, update the RUM user and reconcile the provider with the existing OpenFeature context. Reconciliation preserves fields explicitly supplied through OpenFeature while reading the latest RUM user. + +{{< tabs >}} +{{% tab "Browser" %}} + +```javascript +DD_RUM.setUser(newUser) +await OpenFeature.setContext(OpenFeature.getContext()) +``` + +For logout: + +```javascript +DD_RUM.clearUser() +await OpenFeature.setContext(OpenFeature.getContext()) +``` + +{{% /tab %}} +{{% tab "React Native" %}} + +```tsx +await DdSdkReactNative.setUserInfo(newUser) +await OpenFeature.setContext(OpenFeature.getContext()) +``` + +{{% /tab %}} +{{< /tabs >}} + +Until reconciliation completes, the provider continues to use the previous effective context. Reconciliation fetches assignments for the updated subject before subsequent evaluations use the new context. + +## Add flag evaluations to RUM + +When RUM feature flag tracking is enabled, the Feature Flags SDK adds evaluated flag variants to RUM. RUM events collected after the evaluation include the flag name and variant, which lets you compare user behavior, errors, and performance across variants. + +For information about analyzing evaluations, see [Using Feature Flag Tracking][2]. + +## Disable RUM integration + +Use the RUM integration option documented in the platform's [client SDK guide][1] to opt out. For SDKs that support RUM user context, disabling RUM integration prevents both context enrichment and adding flag evaluations to RUM. + +[1]: /feature_flags/client/ +[2]: /real_user_monitoring/feature_flag_tracking/using_feature_flags/ From 582cee6c3fbe92df90b2d00814b78f489ce25a46 Mon Sep 17 00:00:00 2001 From: Leo Romanovsky Date: Fri, 7 Aug 2026 15:36:50 +0000 Subject: [PATCH 2/4] Consolidate RUM context documentation --- hugo/config/_default/menus/main.en.yaml | 5 - .../content/en/feature_flags/client/_index.md | 20 ++- .../feature_flags/client/rum_integration.md | 117 ------------------ 3 files changed, 17 insertions(+), 125 deletions(-) delete mode 100644 hugo/content/en/feature_flags/client/rum_integration.md diff --git a/hugo/config/_default/menus/main.en.yaml b/hugo/config/_default/menus/main.en.yaml index 57c43145339..6b4e4bc7782 100644 --- a/hugo/config/_default/menus/main.en.yaml +++ b/hugo/config/_default/menus/main.en.yaml @@ -6367,11 +6367,6 @@ menu: parent: feature_flags_client identifier: feature_flags_client_unity weight: 108 - - name: RUM Integration - url: feature_flags/client/rum_integration - parent: feature_flags_client - identifier: feature_flags_client_rum_integration - weight: 109 - name: Server SDKs url: feature_flags/server parent: feature_flags diff --git a/hugo/content/en/feature_flags/client/_index.md b/hugo/content/en/feature_flags/client/_index.md index 81aa262d8fb..441079feb9a 100644 --- a/hugo/content/en/feature_flags/client/_index.md +++ b/hugo/content/en/feature_flags/client/_index.md @@ -73,7 +73,23 @@ Default: `true`. Set to `false` to disable. - **React Native**: `rumIntegrationEnabled` - **Unity**: Not exposed -RUM integration can also use the current RUM user as defaults for feature flag evaluation context. For attribute mapping, precedence, user changes, and opt-out behavior, see [RUM Integration][1]. +### Use RUM user context for evaluation + +For SDKs that support RUM user context, enabling RUM integration also uses attributes from the current RUM user as defaults for evaluation context: + +- The RUM user ID supplies the `targetingKey` when the OpenFeature context does not define one. +- Flat string, number, and Boolean user attributes supply evaluation attributes. Nested objects, arrays, `null`, and other values are excluded rather than flattened. +- Fields explicitly supplied through OpenFeature take precedence over fields from the RUM user. + +Set the RUM user before registering the Feature Flags provider. Changing the RUM user after provider initialization does not automatically update the effective evaluation context. After a login, logout, or account switch, call the platform's evaluation context update API with the existing OpenFeature context. This causes the provider to read the latest RUM user while preserving explicitly supplied fields. + +For the Web and React Native providers, reconcile the context with: + +```javascript +await OpenFeature.setContext(OpenFeature.getContext()) +``` + +Until reconciliation completes, the provider continues to use the previous effective context for assignment requests, evaluations, and telemetry. Disabling RUM integration also disables RUM user context enrichment. ## Testing with in-memory providers @@ -128,5 +144,3 @@ const evaluationContext = { For percentage-based rollouts and deterministic bucketing, see [Traffic Splitting and Randomization](/feature_flags/concepts/traffic_splitting/). {{< partial name="whats-next/whats-next.html" >}} - -[1]: /feature_flags/client/rum_integration/ diff --git a/hugo/content/en/feature_flags/client/rum_integration.md b/hugo/content/en/feature_flags/client/rum_integration.md deleted file mode 100644 index 6a199d059b5..00000000000 --- a/hugo/content/en/feature_flags/client/rum_integration.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: RUM Integration -description: Use RUM user attributes in feature flag evaluation context and add flag evaluations to RUM events. -further_reading: -- link: "/feature_flags/client/" - tag: "Documentation" - text: "Client-Side Feature Flags" -- link: "/real_user_monitoring/feature_flag_tracking/" - tag: "Documentation" - text: "RUM Feature Flag Tracking" -- link: "https://openfeature.dev/docs/reference/concepts/evaluation-context/" - tag: "External" - text: "OpenFeature Evaluation Context" ---- - -## Overview - -Datadog client Feature Flags SDKs can integrate with Real User Monitoring (RUM) in two ways: - -- Use the current RUM user as default values for the feature flag evaluation context. -- Add feature flag evaluation results to RUM events for analysis in RUM Feature Flag Tracking. - -RUM integration availability and configuration depend on the platform and SDK version. See the [client SDK guide][1] for your platform. - -## Use RUM user context for flag evaluation - -When RUM user context integration is enabled, the Feature Flags provider reads the RUM user when the provider initializes or reconciles an evaluation context. The provider combines the RUM user with context explicitly supplied through OpenFeature: - -| RUM user data | Evaluation context behavior | -|---|---| -| User ID | Supplies the `targetingKey` when the OpenFeature context does not define one. | -| Flat string, number, and Boolean user attributes | Supply evaluation attributes when the OpenFeature context does not define attributes with the same names. | -| Nested objects, arrays, `null`, and other values | Are not added to the evaluation context. | - -The provider does not recursively flatten nested values. Some RUM user APIs store custom attributes in a container such as `extraInfo`. In those SDKs, the provider copies supported primitive entries from the container and excludes nested values. - -Fields explicitly supplied through OpenFeature take precedence over fields from the RUM user. This lets the application override a RUM value for feature flag targeting without changing the RUM user. - -An online provider uses the effective context for assignment requests, flag evaluation, exposure events, and evaluation telemetry. This keeps targeting and telemetry associated with the same subject. Precomputed and offline provider behavior depends on the platform because a configuration can be bound to a specific context. - -### Set the RUM user before the provider - -Set the RUM user before registering the Feature Flags provider. This lets the provider use the RUM user for its initial assignment request. - -{{< tabs >}} -{{% tab "Browser" %}} - -```javascript -DD_RUM.setUser({ - id: 'user-123', - email: 'user@example.com', - plan: 'premium', -}) - -await OpenFeature.setProviderAndWait(new DatadogProvider(configuration)) -``` - -{{% /tab %}} -{{% tab "React Native" %}} - -```tsx -await DdSdkReactNative.setUserInfo({ - id: 'user-123', - email: 'user@example.com', - extraInfo: { plan: 'premium' }, -}) - -await OpenFeature.setProviderAndWait(new DatadogOpenFeatureProvider()) -``` - -{{% /tab %}} -{{< /tabs >}} - -### Reconcile context after the RUM user changes - -Changing the RUM user after provider initialization does not automatically change the effective evaluation context. After a login, logout, or account switch, update the RUM user and reconcile the provider with the existing OpenFeature context. Reconciliation preserves fields explicitly supplied through OpenFeature while reading the latest RUM user. - -{{< tabs >}} -{{% tab "Browser" %}} - -```javascript -DD_RUM.setUser(newUser) -await OpenFeature.setContext(OpenFeature.getContext()) -``` - -For logout: - -```javascript -DD_RUM.clearUser() -await OpenFeature.setContext(OpenFeature.getContext()) -``` - -{{% /tab %}} -{{% tab "React Native" %}} - -```tsx -await DdSdkReactNative.setUserInfo(newUser) -await OpenFeature.setContext(OpenFeature.getContext()) -``` - -{{% /tab %}} -{{< /tabs >}} - -Until reconciliation completes, the provider continues to use the previous effective context. Reconciliation fetches assignments for the updated subject before subsequent evaluations use the new context. - -## Add flag evaluations to RUM - -When RUM feature flag tracking is enabled, the Feature Flags SDK adds evaluated flag variants to RUM. RUM events collected after the evaluation include the flag name and variant, which lets you compare user behavior, errors, and performance across variants. - -For information about analyzing evaluations, see [Using Feature Flag Tracking][2]. - -## Disable RUM integration - -Use the RUM integration option documented in the platform's [client SDK guide][1] to opt out. For SDKs that support RUM user context, disabling RUM integration prevents both context enrichment and adding flag evaluations to RUM. - -[1]: /feature_flags/client/ -[2]: /real_user_monitoring/feature_flag_tracking/using_feature_flags/ From f3ebb3dc827eb74da0fb52b18a3ca90d2dc94bfe Mon Sep 17 00:00:00 2001 From: Leo Romanovsky Date: Fri, 7 Aug 2026 15:47:16 +0000 Subject: [PATCH 3/4] Generalize RUM context guidance --- hugo/content/en/feature_flags/client/_index.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hugo/content/en/feature_flags/client/_index.md b/hugo/content/en/feature_flags/client/_index.md index 441079feb9a..f94344c9d58 100644 --- a/hugo/content/en/feature_flags/client/_index.md +++ b/hugo/content/en/feature_flags/client/_index.md @@ -75,21 +75,20 @@ Default: `true`. Set to `false` to disable. ### Use RUM user context for evaluation -For SDKs that support RUM user context, enabling RUM integration also uses attributes from the current RUM user as defaults for evaluation context: +For client SDKs that support RUM user context, enabling RUM integration also uses attributes from the current RUM user as defaults for evaluation context: -- The RUM user ID supplies the `targetingKey` when the OpenFeature context does not define one. +- The RUM user ID supplies the targeting key when the application evaluation context does not define one. - Flat string, number, and Boolean user attributes supply evaluation attributes. Nested objects, arrays, `null`, and other values are excluded rather than flattened. -- Fields explicitly supplied through OpenFeature take precedence over fields from the RUM user. +- Fields explicitly supplied through the application evaluation context take precedence over fields from the RUM user. -Set the RUM user before registering the Feature Flags provider. Changing the RUM user after provider initialization does not automatically update the effective evaluation context. After a login, logout, or account switch, call the platform's evaluation context update API with the existing OpenFeature context. This causes the provider to read the latest RUM user while preserving explicitly supplied fields. +Initialize RUM and set the RUM user before creating the Feature Flags client or provider. This lets the SDK include RUM user attributes in its initial assignment request. -For the Web and React Native providers, reconcile the context with: +Changing the RUM user after Feature Flags initialization does not automatically update the effective evaluation context. After a login, logout, or account switch: -```javascript -await OpenFeature.setContext(OpenFeature.getContext()) -``` +1. Update the user through the platform's RUM user API. +2. Trigger an evaluation context update through the platform's Feature Flags API. Reuse the application's explicit evaluation context so those fields remain intact. -Until reconciliation completes, the provider continues to use the previous effective context for assignment requests, evaluations, and telemetry. Disabling RUM integration also disables RUM user context enrichment. +The user and context APIs differ across Web, Android, Dart/Flutter, iOS, React Native, and Unity. See the client SDK guide for your platform. Until the context update completes, the client or provider continues to use the previous effective context for assignment requests, evaluations, and telemetry. On platforms that expose a RUM integration setting, disabling RUM integration also disables RUM user context enrichment. ## Testing with in-memory providers From 7f8aa1073bca83727b4b9479c7f44bae178e1f32 Mon Sep 17 00:00:00 2001 From: Leo Romanovsky Date: Fri, 7 Aug 2026 15:53:22 +0000 Subject: [PATCH 4/4] Address RUM context documentation feedback --- hugo/content/en/feature_flags/client/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugo/content/en/feature_flags/client/_index.md b/hugo/content/en/feature_flags/client/_index.md index f94344c9d58..5843aebec0a 100644 --- a/hugo/content/en/feature_flags/client/_index.md +++ b/hugo/content/en/feature_flags/client/_index.md @@ -88,7 +88,7 @@ Changing the RUM user after Feature Flags initialization does not automatically 1. Update the user through the platform's RUM user API. 2. Trigger an evaluation context update through the platform's Feature Flags API. Reuse the application's explicit evaluation context so those fields remain intact. -The user and context APIs differ across Web, Android, Dart/Flutter, iOS, React Native, and Unity. See the client SDK guide for your platform. Until the context update completes, the client or provider continues to use the previous effective context for assignment requests, evaluations, and telemetry. On platforms that expose a RUM integration setting, disabling RUM integration also disables RUM user context enrichment. +The user and context APIs differ by client SDK. Select your platform from the cards at the top of this page for API details. Until the context update completes, the client or provider continues to use the previous effective context for assignment requests, evaluations, and telemetry. On platforms that expose a RUM integration setting, disabling RUM integration also disables RUM user context enrichment. ## Testing with in-memory providers