-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
docs(flags): Add OpenFeature JS integration docs #11837
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,51 @@ | ||||||||||||||
--- | ||||||||||||||
title: OpenFeature | ||||||||||||||
description: "Attaches recent OpenFeature feature flag evaluations to error event context." | ||||||||||||||
notSupported: | ||||||||||||||
- javascript.aws-lambda | ||||||||||||||
- javascript.azure-functions | ||||||||||||||
- javascript.bun | ||||||||||||||
- javascript.capacitor | ||||||||||||||
- javascript.cloudflare | ||||||||||||||
- javascript.connect | ||||||||||||||
- javascript.cordova | ||||||||||||||
- javascript.deno | ||||||||||||||
- javascript.electron | ||||||||||||||
- javascript.express | ||||||||||||||
- javascript.fastify | ||||||||||||||
- javascript.gcp-functions | ||||||||||||||
- javascript.hapi | ||||||||||||||
- javascript.koa | ||||||||||||||
- javascript.nestjs | ||||||||||||||
- javascript.nodejs | ||||||||||||||
- javascript.wasm | ||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
<Alert level="info"> | ||||||||||||||
|
||||||||||||||
This integration only works inside a browser environment. | ||||||||||||||
|
||||||||||||||
</Alert> | ||||||||||||||
|
||||||||||||||
_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_ | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we should also add an alert saying this is in beta to match the other docs (same with the LD JS doc too) i've been doing this:
|
||||||||||||||
|
||||||||||||||
The [OpenFeature](https://https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.** | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
```JavaScript | ||||||||||||||
import * as Sentry from '@sentry/browser'; | ||||||||||||||
import { OpenFeature } from '@openfeature/web-sdk'; | ||||||||||||||
|
||||||||||||||
Sentry.init({integrations: [Sentry.openFeatureIntegration()]}); | ||||||||||||||
|
||||||||||||||
const client = OpenFeature.getClient(); | ||||||||||||||
client.addHooks(new Sentry.OpenFeatureIntegrationHook()); | ||||||||||||||
|
||||||||||||||
// Evaluating flags will record the result on the Sentry client. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
const result = client.getBooleanValue('my-flag', false); | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
Learn more about the OpenFeature SDK at https://github.com/open-feature/js-sdk/tree/main. | ||||||||||||||
|
||||||||||||||
## Options | ||||||||||||||
|
||||||||||||||
There are no setup options for this integration. | ||||||||||||||
Comment on lines
+49
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe it's better to just not have this section since there aren't any options? |
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.