Skip to content

Enable RUM feature flag tracking by default if RUM is available#176

Merged
petzel merged 4 commits intomainfrom
eric/rum-feature-flag-tracking
Feb 10, 2026
Merged

Enable RUM feature flag tracking by default if RUM is available#176
petzel merged 4 commits intomainfrom
eric/rum-feature-flag-tracking

Conversation

@petzel
Copy link
Copy Markdown
Contributor

@petzel petzel commented Feb 8, 2026

Motivation

Currently, if a user wants to enable RUM Feature Flag Tracking, they need to set deprecated configuration fields. If these fields happen to be set, the variant values are used, rather than the variant keys, which is not desirable primarily since JSON flags a) lead to a poor UX and b) use significantly more storage than keys in most cases.

Changes

This PR adds a new hook which automatically adds feature flag information to RUM events by calling rum.addFeatureFlagEvaluation if RUM is available. Users can optionally disable this tracking by setting enableRumFeatureFlagTracking: false when initializing.

For some reason, the variant keys being returned by the precomputed endpoint do not contain exactly what the user entered as the variant key - they include a suffix (such as -0). Since this comes from the backend/another repo, I will update this in a separate PR.

Test instructions

  • Unit tests
  • End to end testing:
    • Create feature flag variants where the key differs from the value
    • Integrate this branch with a local test app
    • Generate RUM data
    • Ensure the Feature Flag tracking data in Datadog contains variant keys rather than values
image image

Checklist

  • Updated Documentation
  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@petzel petzel requested a review from a team as a code owner February 8, 2026 19:38
Comment on lines -59 to +60
// Should have 2 hooks: flag evaluation tracking (default true) + exposure logging (default true)
expect(providerWithDefaults.hooks).toHaveLength(2)
// Should have 3 hooks: flag evaluation tracking (default true) + exposure logging (default true) + auto RUM tracking
expect(providerWithDefaults.hooks).toHaveLength(3)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for this; I haven't figure out a "good way" to test it otherwise. Did you find it valuable or a chore?

@petzel petzel merged commit 79fb07d into main Feb 10, 2026
4 checks passed
@petzel petzel deleted the eric/rum-feature-flag-tracking branch February 10, 2026 18:59
@leoromanovsky leoromanovsky mentioned this pull request Mar 2, 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.

2 participants