Skip to content
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): Adds LaunchDarkly and OpenFeature integrations #14207

Merged
merged 84 commits into from
Dec 4, 2024

Conversation

aliu39
Copy link
Member

@aliu39 aliu39 commented Nov 7, 2024

Adds browser integrations for tracking feature flag evaluations through the LaunchDarkly JS SDK and OpenFeature Web 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:

  1. we are storing the flags in the current scope's context, and copying them to the event context on error. This way we don't have to extend the scope class/core package. Potential follow-ups:
  1. users have to manually register the FF SDK hook (e.g. LDInspectionFlagUsedHandler) separately from Sentry.init(). Unlike python, it's not possible to do this when instantiating the integration.
  2. this hook is available for client SDKs only, hence why this is a browser only integration.
  3. To keep bundle sizes light, this integration is not exported to CDN bundles. Users should install with npm, and we expect tree-shaking to help if this integration is unused.

Both integrations are live and verified to work, in

  • @sentry/browser 8.41.0-beta.1
  • @sentry/react 8.41.0-beta.0

DOCS:
launchdarkly
openfeature
feature flags product index

…ration

feat(flags): Add OpenFeature integration
…tion-abstraction

ref(flags): Refactor LaunchDarkly integration to reusable functions
@cmanallen cmanallen changed the title feat(flags): Add LaunchDarkly integration feat(flags): Adds LaunchDarkly and OpenFeature integrations Dec 2, 2024
cmanallen and others added 6 commits December 2, 2024 08:41
@aliu39 aliu39 requested a review from billyvg December 4, 2024 19:07
@@ -77,3 +68,6 @@ export type { Span } from '@sentry/core';
export { makeBrowserOfflineTransport } from './transports/offline';
export { browserProfilingIntegration } from './profiling/integration';
export { spotlightBrowserIntegration } from './integrations/spotlight';
export { copyFlagsFromScopeToEvent, insertFlagToScope } from './utils/featureFlags';
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove these exports - they shouldn't be public

@aliu39 aliu39 requested a review from billyvg December 4, 2024 19:55
@aliu39 aliu39 merged commit 2a41c84 into develop Dec 4, 2024
154 checks passed
@aliu39 aliu39 deleted the aliu/launch-darkly-integration branch December 4, 2024 20:56
@mydea
Copy link
Member

mydea commented Dec 5, 2024

Just for reference for the next time @aliu39 , please make sure to use squash merge :) No big deal, and we know it is not ideal that we cannot enforce this right now in this repo, so it's a bit of a manual thing sadly 😬

aliu39 added a commit that referenced this pull request Dec 6, 2024
…evaluations (#14582)

Follow-up to #14207. 

Sentry integration for buffering feature flags manually with an API and auto-capturing them on error events.
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.

None yet

8 participants