-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(flags): Add LaunchDarkly integration #14207
base: develop
Are you sure you want to change the base?
Conversation
…try-javascript into aliu/launch-darkly
…try-javascript into aliu/launch-darkly
…ag field and methods
2ba9592
to
d8f2d72
Compare
dev-packages/browser-integration-tests/suites/integrations/featureFlags/launchdarkly/init.js
Outdated
Show resolved
Hide resolved
...es/browser-integration-tests/suites/integrations/featureFlags/launchdarkly/withScope/test.ts
Outdated
Show resolved
Hide resolved
d8f2d72
to
7a5f29d
Compare
ab1bb31
to
8479826
Compare
8479826
to
a2ba257
Compare
await page.waitForFunction(bufferSize => { | ||
const ldClient = (window as any).initializeLD(); | ||
for (let i = 1; i <= bufferSize; i++) { | ||
ldClient.variation(`feat${i}`, false); | ||
} | ||
ldClient.variation(`feat${bufferSize + 1}`, true); // eviction | ||
ldClient.variation('feat3', true); // update | ||
return true; | ||
}, FLAG_BUFFER_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be page.evaluate
right since we're not waiting for anything async inside
await page.waitForFunction(() => { | ||
const Sentry = (window as any).Sentry; | ||
const errorButton = document.querySelector('#error') as HTMLButtonElement; | ||
const ldClient = (window as any).initializeLD(); | ||
|
||
ldClient.variation('shared', true); | ||
|
||
Sentry.withScope((scope: Scope) => { | ||
ldClient.variation('forked', true); | ||
ldClient.variation('shared', false); | ||
scope.setTag('isForked', true); | ||
if (errorButton) { | ||
errorButton.click(); | ||
} | ||
}); | ||
|
||
ldClient.variation('main', true); | ||
Sentry.getCurrentScope().setTag('isForked', false); | ||
errorButton.click(); | ||
return true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here re: page.evaluate?
* | ||
* @returns `true` if we should skip the launchdarkly test | ||
*/ | ||
export function shouldSkipLaunchDarklyTest(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be more generic? e.g. feature flags instead of just launch darkly, esp if we're going to add other vendors.
export function shouldSkipLaunchDarklyTest(): boolean { | |
export function shouldSkipLaunchDarklyTest(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it can be!
Adds a browser integration for tracking feature flag evaluations through the LaunchDarkly JS SDK.
Notion doc summarizing our goal, constraints, and potential approaches: https://www.notion.so/sentry/Feature-Flags-JavaScript-SDK-1358b10e4b5d805288abe1a4fede75ed?pvs=4. This PR implements approach 1.
Also see https://develop.sentry.dev/sdk/expected-features/#feature-flags
Ref
Decisions:
LDInspectionFlagUsedHandler
) separately from theSentry.init()
call, since the only way to do so is in [LD].initialize()
.