From dc5b2e5bb8a4b498b9ccf80cbfae5ff27fe59618 Mon Sep 17 00:00:00 2001 From: Colton Allen Date: Fri, 15 Nov 2024 13:52:55 -0600 Subject: [PATCH 1/2] Add OpenFeature integration docs --- .../integrations/openfeature.mdx | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docs/platforms/javascript/common/configuration/integrations/openfeature.mdx 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..eed5679181b49 --- /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 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. From b26e949a9a0aa8227e7ab73bffafabe982784443 Mon Sep 17 00:00:00 2001 From: Colton Allen Date: Fri, 15 Nov 2024 14:07:17 -0600 Subject: [PATCH 2/2] Fix namespacing --- .../common/configuration/integrations/openfeature.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx index eed5679181b49..13173985a2dc9 100644 --- a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx @@ -38,7 +38,7 @@ import { OpenFeature } from '@openfeature/web-sdk'; Sentry.init({integrations: [Sentry.openFeatureIntegration()]}); const client = OpenFeature.getClient(); -client.addHooks(new OpenFeatureIntegrationHook()); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); // Evaluating flags will record the result on the Sentry client. const result = client.getBooleanValue('my-flag', false);