diff --git a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx new file mode 100644 index 0000000000000..13173985a2dc9 --- /dev/null +++ b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx @@ -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 +--- + + + +This integration only works inside a browser environment. + + + +_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_ + +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.** + +```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. +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.