Skip to content

✨ FFL-16 Precomputed flags evaluation #3580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

leoromanovsky
Copy link
Contributor

@leoromanovsky leoromanovsky commented May 29, 2025

Motivation

Precomputed flags evaluation + small fixes on top of #3554.

πŸ› Open Bug: unit tests were failing in chrome 63 (https://gitlab.ddbuild.io/DataDog/browser-sdk/-/jobs/959532643) and trying to fix with changes to polyfill.

Changes

  • Precomputed flags evaluation
  • Fetching remote configuration
  • Option to set initial configuration from configuration wire

See individual commits for more details.

Test instructions

Checklist

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

@codecov-commenter
Copy link

codecov-commenter commented May 29, 2025

Codecov Report

Attention: Patch coverage is 59.64912% with 23 lines in your changes missing coverage. Please review.

Project coverage is 92.12%. Comparing base (a0a7fdb) to head (9437999).

Files with missing lines Patch % Lines
packages/flagging/src/openfeature/provider.ts 51.61% 15 Missing ⚠️
packages/flagging/src/configuration/wire.ts 53.33% 7 Missing ⚠️
packages/flagging/src/evaluation.ts 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3580      +/-   ##
==========================================
- Coverage   92.33%   92.12%   -0.22%     
==========================================
  Files         319      322       +3     
  Lines        8104     8161      +57     
  Branches     1831     1840       +9     
==========================================
+ Hits         7483     7518      +35     
- Misses        621      643      +22     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leoromanovsky leoromanovsky marked this pull request as ready for review May 29, 2025 18:00
@leoromanovsky leoromanovsky requested review from a team as code owners May 29, 2025 18:00
Revert previous attempts at polyfilling globalThis (commits
013e074 and
e5103f7)
@@ -1,5 +1,5 @@
{
"name": "@datadog/browser-flagging",
"name": "@datadog/openfeature-provider",
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: (as discussed) it could be nice to rename the package folder as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My notes from the conversation was we left it without consensus but I am ok revisiting it as the SDK scope becomes more clear; there might be more than just the openfeature provided being exported; perhaps where we will land is a core flagging package (here or in a shared javascript repository with react native) and openfeature provider as a wrapper on it.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.

Copy link

Bundles Sizes Evolution

πŸ“¦ Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 146.07 KiB 146.07 KiB 0 B 0.00% βœ…
Rum Recorder 18.02 KiB 18.02 KiB 0 B 0.00% βœ…
Rum Profiler 4.63 KiB 4.63 KiB 0 B 0.00% βœ…
Logs 50.26 KiB 50.26 KiB 0 B 0.00% βœ…
Flagging 0 B 25.82 KiB 25.82 KiB N/A% βœ…
Rum Slim 105.70 KiB 105.70 KiB 0 B 0.00% βœ…
Worker 23.59 KiB 23.59 KiB 0 B 0.00% βœ…
πŸš€ CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.008 0.008 0.000
addaction 0.037 0.030 -0.007
addtiming 0.006 0.010 0.004
adderror 0.029 0.036 0.008
startstopsessionreplayrecording 0.001 0.002 0.000
startview 0.007 0.011 0.004
logmessage 0.026 0.048 0.022
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 27.61 KiB 26.35 KiB -1292 B
addaction 58.35 KiB 52.87 KiB -5613 B
addtiming 26.95 KiB 24.62 KiB -2383 B
adderror 62.91 KiB 57.48 KiB -5554 B
startstopsessionreplayrecording 25.95 KiB 23.50 KiB -2516 B
startview 432.13 KiB 428.58 KiB -3637 B
logmessage 55.49 KiB 55.45 KiB -48 B

πŸ”— RealWorld

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.

5 participants