From fd22a8d1483bf2e9f5c34e5138731f7cf9c40a20 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:42:17 -0800 Subject: [PATCH 01/12] feat(flags): document featureFlagsIntegration for custom flag tracking --- .../integrations/featureFlags.mdx | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx diff --git a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx new file mode 100644 index 0000000000000..f9f6b15ce4d57 --- /dev/null +++ b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx @@ -0,0 +1,70 @@ +--- +title: Feature Flags +description: "Learn how to attach custom feature flag data to Sentry error events." +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. + + + +The Feature Flags integration allows you to manually track feature flag evaluations through an API. 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.** + +_Import names: `Sentry.featureFlagsIntegration` and `type Sentry.FeatureFlagsIntegration`_ + +## Install + +Install your platform's Sentry SDK from npm. + +## Configure + +```JavaScript +import * as Sentry from '@sentry/'; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [Sentry.featureFlagsIntegration()] +}); +``` + +## Verify + +The integration is tested by calling the `addFeatureFlag` method before capturing an exception. + +```JavaScript +import * as Sentry from '@sentry/browser'; + +const flagsIntegration = Sentry.getClient()?.getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('hello', false); +} else { + // check your configure step +} +Sentry.captureException(Exception('broke')); +``` + +Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". + + From 1f9de9b607ea12b91e9816ad3d6082a52cf49116 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:23:51 -0800 Subject: [PATCH 02/12] Lowercase filename and create python file --- docs/platforms/python/integrations/featureflags/index.mdx | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/platforms/python/integrations/featureflags/index.mdx diff --git a/docs/platforms/python/integrations/featureflags/index.mdx b/docs/platforms/python/integrations/featureflags/index.mdx new file mode 100644 index 0000000000000..e69de29bb2d1d From 1c15c37be676471a0ff4ac2e7c0a8cd54c07b260 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:27:36 -0800 Subject: [PATCH 03/12] Del python doc --- docs/platforms/python/integrations/featureflags/index.mdx | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/platforms/python/integrations/featureflags/index.mdx diff --git a/docs/platforms/python/integrations/featureflags/index.mdx b/docs/platforms/python/integrations/featureflags/index.mdx deleted file mode 100644 index e69de29bb2d1d..0000000000000 From ad16c127944c46d774362d3b96f298886237691a Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:43:31 -0800 Subject: [PATCH 04/12] review comment Co-authored-by: Billy Vong --- .../common/configuration/integrations/featureFlags.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx index f9f6b15ce4d57..a5853fc0791c5 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx @@ -29,7 +29,7 @@ This integration only works inside a browser environment. -The Feature Flags integration allows you to manually track feature flag evaluations through an API. These evaluations are held in memory, and in the event an error occurs, sent to Sentry for review and analysis. +The Feature Flags integration allows you to manually track feature flag evaluations through an API. These evaluations are held in memory and sent to Sentry when an error occurs. **At the moment, we only support boolean flag evaluations.** _Import names: `Sentry.featureFlagsIntegration` and `type Sentry.FeatureFlagsIntegration`_ From d69649f166449af330325473a9595db943b5209c Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:46:37 -0800 Subject: [PATCH 05/12] keep title consistent w identifier --- .../common/configuration/integrations/featureFlags.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx index a5853fc0791c5..c10ff8f77825f 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx @@ -1,5 +1,5 @@ --- -title: Feature Flags +title: FeatureFlags description: "Learn how to attach custom feature flag data to Sentry error events." notSupported: - javascript.aws-lambda From 294718db602069cd48a8efb0b6a68bda7013e0d8 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:48:58 -0800 Subject: [PATCH 06/12] Rename featureFlags.mdx to featureflags.mdx --- .../integrations/{featureFlags.mdx => featureflags.mdx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/platforms/javascript/common/configuration/integrations/{featureFlags.mdx => featureflags.mdx} (100%) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx similarity index 100% rename from docs/platforms/javascript/common/configuration/integrations/featureFlags.mdx rename to docs/platforms/javascript/common/configuration/integrations/featureflags.mdx From e0e050df03e7324ed62303f530e23b3d469493ba Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:50:40 -0800 Subject: [PATCH 07/12] Keep sentry/browser in code snippet --- .../common/configuration/integrations/featureflags.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx index c10ff8f77825f..a8eeaf4e504b9 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx @@ -41,7 +41,7 @@ Install your platform's Sentry SDK from npm. ## Configure ```JavaScript -import * as Sentry from '@sentry/'; +import * as Sentry from '@sentry/browser'; Sentry.init({ dsn: "___PUBLIC_DSN___", From 40ce74de12479703cb93c035b3376b6c5257cfcb Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:55:30 -0800 Subject: [PATCH 08/12] Link from js index --- docs/platforms/javascript/common/feature-flags/index.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/platforms/javascript/common/feature-flags/index.mdx b/docs/platforms/javascript/common/feature-flags/index.mdx index b8bda352ae012..65f4ba0f39b95 100644 --- a/docs/platforms/javascript/common/feature-flags/index.mdx +++ b/docs/platforms/javascript/common/feature-flags/index.mdx @@ -34,4 +34,6 @@ Evaluation tracking requires enabling an SDK integration. Integrations are provi - [OpenFeature](/platforms/javascript/configuration/integrations/openfeature/) - [LaunchDarkly](/platforms/javascript/configuration/integrations/launchdarkly/) +To manually track evaluations through an API, see the custom [FeatureFlags](/platforms/javascript/configuration/integrations/featureflags/) integration. + From 2ace2169246208e1b6586b4dc8d0bcbf4b93ec5e Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:02:40 -0800 Subject: [PATCH 09/12] Link index from integration doc --- .../common/configuration/integrations/featureflags.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx index a8eeaf4e504b9..c9ed3799f5d67 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx @@ -25,7 +25,8 @@ notSupported: -This integration only works inside a browser environment. +This integration only works inside a browser environment. If you are using a specific +feature flag provider, refer to the supported list [here](/platforms/javascript/feature-flags/#enable-evaluation-tracking) before setting up this integration. From 42771183ee338e25fdbfded1971b973452cd772c Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:04:49 -0800 Subject: [PATCH 10/12] Fix invalid Exception syntax --- .../common/configuration/integrations/featureflags.mdx | 2 +- .../common/configuration/integrations/launchdarkly.mdx | 2 +- .../common/configuration/integrations/openfeature.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx index c9ed3799f5d67..22caf626438e8 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx @@ -63,7 +63,7 @@ if (flagsIntegration) { } else { // check your configure step } -Sentry.captureException(Exception('broke')); +Sentry.captureException(new Error('broke')); ``` Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". diff --git a/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx b/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx index 0559fb739472f..12dddb26e6e16 100644 --- a/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx @@ -69,7 +69,7 @@ import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; // You may have to wait for your client to initialize before doing this. ldClient?.variation("hello", false); -Sentry.captureException(Exception("Something went wrong!")) +Sentry.captureException(new Error("Something went wrong!")) ``` Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". diff --git a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx index 28813ad5dd320..2396c818cfa9e 100644 --- a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx @@ -73,7 +73,7 @@ import { OpenFeature } from '@openfeature/web-sdk'; const client = OpenFeature.getClient(); const result = client.getBooleanValue('hello', false); -Sentry.captureException(Exception("Something went wrong!")) +Sentry.captureException(new Error("Something went wrong!")) ``` Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". From fb02818f588de0f17c5c09356fe32f23709af3b9 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:18:13 -0800 Subject: [PATCH 11/12] ref(flags): add platform-specific content and refactor JS integration docs (#12172) * ref(flags): add platform-specific content to JS integration docs * featureflags platforms * ld and of platforms * Rm 'Install with npm or yarn' * Label featureflags code as TypeScript * Update info alert and ffs link * Lowercase all code snippet language headers * Rewording from review * Use single quotes in all code snippets * Update provider pkg and docs links --- .../integrations/featureflags.mdx | 43 ++++------------- .../integrations/launchdarkly.mdx | 43 ++--------------- .../integrations/openfeature.mdx | 47 ++----------------- .../featureflags/javascript.angular.mdx | 17 +++++++ .../featureflags/javascript.astro.mdx | 17 +++++++ .../featureflags/javascript.ember.mdx | 17 +++++++ .../featureflags/javascript.gatsby.mdx | 17 +++++++ .../configuration/featureflags/javascript.mdx | 17 +++++++ .../featureflags/javascript.nextjs.mdx | 17 +++++++ .../featureflags/javascript.nuxt.mdx | 17 +++++++ .../featureflags/javascript.react.mdx | 17 +++++++ .../featureflags/javascript.remix.mdx | 17 +++++++ .../featureflags/javascript.solid.mdx | 17 +++++++ .../featureflags/javascript.solidstart.mdx | 17 +++++++ .../featureflags/javascript.svelte.mdx | 17 +++++++ .../featureflags/javascript.sveltekit.mdx | 17 +++++++ .../featureflags/javascript.vue.mdx | 17 +++++++ .../launchdarkly/javascript.angular.mdx | 22 +++++++++ .../launchdarkly/javascript.astro.mdx | 22 +++++++++ .../launchdarkly/javascript.ember.mdx | 22 +++++++++ .../launchdarkly/javascript.gatsby.mdx | 22 +++++++++ .../configuration/launchdarkly/javascript.mdx | 22 +++++++++ .../launchdarkly/javascript.nextjs.mdx | 22 +++++++++ .../launchdarkly/javascript.nuxt.mdx | 22 +++++++++ .../launchdarkly/javascript.react.mdx | 22 +++++++++ .../launchdarkly/javascript.remix.mdx | 22 +++++++++ .../launchdarkly/javascript.solid.mdx | 22 +++++++++ .../launchdarkly/javascript.solidstart.mdx | 22 +++++++++ .../launchdarkly/javascript.svelte.mdx | 22 +++++++++ .../launchdarkly/javascript.sveltekit.mdx | 22 +++++++++ .../launchdarkly/javascript.vue.mdx | 22 +++++++++ .../openfeature/javascript.angular.mdx | 35 ++++++++++++++ .../openfeature/javascript.astro.mdx | 35 ++++++++++++++ .../openfeature/javascript.ember.mdx | 35 ++++++++++++++ .../openfeature/javascript.gatsby.mdx | 35 ++++++++++++++ .../configuration/openfeature/javascript.mdx | 35 ++++++++++++++ .../openfeature/javascript.nextjs.mdx | 35 ++++++++++++++ .../openfeature/javascript.nuxt.mdx | 35 ++++++++++++++ .../openfeature/javascript.react.mdx | 35 ++++++++++++++ .../openfeature/javascript.remix.mdx | 35 ++++++++++++++ .../openfeature/javascript.solid.mdx | 35 ++++++++++++++ .../openfeature/javascript.solidstart.mdx | 35 ++++++++++++++ .../openfeature/javascript.svelte.mdx | 35 ++++++++++++++ .../openfeature/javascript.sveltekit.mdx | 35 ++++++++++++++ .../openfeature/javascript.vue.mdx | 35 ++++++++++++++ 45 files changed, 1052 insertions(+), 117 deletions(-) create mode 100644 platform-includes/configuration/featureflags/javascript.angular.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.astro.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.ember.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.gatsby.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.nextjs.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.nuxt.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.react.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.remix.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.solid.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.solidstart.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.svelte.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.sveltekit.mdx create mode 100644 platform-includes/configuration/featureflags/javascript.vue.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.angular.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.astro.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.ember.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.gatsby.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.nextjs.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.nuxt.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.react.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.remix.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.solid.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.solidstart.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.svelte.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.sveltekit.mdx create mode 100644 platform-includes/configuration/launchdarkly/javascript.vue.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.angular.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.astro.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.ember.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.gatsby.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.nextjs.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.nuxt.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.react.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.remix.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.solid.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.solidstart.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.svelte.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.sveltekit.mdx create mode 100644 platform-includes/configuration/openfeature/javascript.vue.mdx diff --git a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx index 22caf626438e8..718234edd9b85 100644 --- a/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx @@ -25,47 +25,24 @@ notSupported: -This integration only works inside a browser environment. If you are using a specific -feature flag provider, refer to the supported list [here](/platforms/javascript/feature-flags/#enable-evaluation-tracking) before setting up this integration. +This integration only works inside a browser environment. It is only available from a package-based install (e.g. `npm` or `yarn`). -The Feature Flags integration allows you to manually track feature flag evaluations through an API. These evaluations are held in memory and sent to Sentry when an error occurs. -**At the moment, we only support boolean flag evaluations.** - -_Import names: `Sentry.featureFlagsIntegration` and `type Sentry.FeatureFlagsIntegration`_ - -## Install - -Install your platform's Sentry SDK from npm. + -## Configure +If you are using an external feature flag provider, refer to the [supported list](/platforms/javascript/feature-flags/#enable-evaluation-tracking) before setting up this integration. -```JavaScript -import * as Sentry from '@sentry/browser'; - -Sentry.init({ - dsn: "___PUBLIC_DSN___", - integrations: [Sentry.featureFlagsIntegration()] -}); -``` - -## Verify + -The integration is tested by calling the `addFeatureFlag` method before capturing an exception. +The Feature Flags integration allows you to manually track feature flag evaluations through an API. +These evaluations are held in memory and sent to Sentry when an error occurs. +**At the moment, we only support boolean flag evaluations.** -```JavaScript -import * as Sentry from '@sentry/browser'; +_Import names: `Sentry.featureFlagsIntegration` and `type Sentry.FeatureFlagsIntegration`_ -const flagsIntegration = Sentry.getClient()?.getIntegrationByName('FeatureFlags'); -if (flagsIntegration) { - flagsIntegration.addFeatureFlag('hello', false); -} else { - // check your configure step -} -Sentry.captureException(new Error('broke')); -``` + -Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". +Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false". diff --git a/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx b/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx index 12dddb26e6e16..26e4791c9beac 100644 --- a/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx @@ -25,7 +25,7 @@ notSupported: -This integration only works inside a browser environment. +This integration only works inside a browser environment. It is only available from a package-based install (e.g. `npm` or `yarn`). @@ -33,45 +33,8 @@ The [LaunchDarkly](https://launchdarkly.com/) integration tracks feature flag ev _Import names: `Sentry.launchDarklyIntegration` and `Sentry.buildLaunchDarklyFlagUsedHandler`_ -## Install + -Install your platform's Sentry SDK and [`launchdarkly-js-client-sdk`](https://www.npmjs.com/package/launchdarkly-js-client-sdk) from npm. - -## Configure - -```JavaScript -import * as Sentry from '@sentry/browser'; -import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; - -Sentry.init({ - dsn: "___PUBLIC_DSN___", - integrations: [Sentry.launchDarklyIntegration()] -}); - -const ldClient = LaunchDarkly.initialize( - 'my-client-ID', - {kind: 'user', key: 'my-user-context-key'}, - {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} -); -``` - -Learn more about the [LaunchDarkly SDK](https://docs.launchdarkly.com/sdk/client-side/javascript). At the moment, **we aren't officially supporting framework-specific LaunchDarkly SDKs.** However, you may reuse the setup code for [React](https://www.npmjs.com/package/launchdarkly-react-client-sdk) and [client-side Node.js](https://www.npmjs.com/package/launchdarkly-node-client-sdk). - -## Verify - -The integration is tested by evaluating a feature flag with your LaunchDarkly SDK before capturing an exception. - -```JavaScript -import * as Sentry from '@sentry/browser'; -import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; - -// Evaluate a flag with a default value, with the ldClient from the Configure step. -// You may have to wait for your client to initialize before doing this. -ldClient?.variation("hello", false); - -Sentry.captureException(new Error("Something went wrong!")) -``` - -Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". +Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false". diff --git a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx index 2396c818cfa9e..2d64f586f66f8 100644 --- a/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/openfeature.mdx @@ -25,7 +25,7 @@ notSupported: -This integration only works inside a browser environment. +This integration only works inside a browser environment. It is only available from a package-based install (e.g. `npm` or `yarn`). @@ -33,49 +33,8 @@ The [OpenFeature](https://openfeature.dev/) integration tracks feature flag eval _Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_ -## Install + -Install your platform's Sentry SDK and [`@openfeature/web-sdk`](https://www.npmjs.com/package/@openfeature/web-sdk) from npm. - -## Configure - -```JavaScript -import * as Sentry from '@sentry/browser'; -import { OpenFeature } from '@openfeature/web-sdk'; - -Sentry.init({ - dsn: "___PUBLIC_DSN___", - integrations: [Sentry.openFeatureIntegration()] -}); - -OpenFeature.setProvider(new MyProviderOfChoice()); - -// Option 1: track all OpenFeature evaluations. -OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); - -// Option 2: only track evaluations by a specific client. -const client = OpenFeature.getClient(); -client.addHooks(new Sentry.OpenFeatureIntegrationHook()); -``` - -Learn more about OpenFeature [providers](https://openfeature.dev/docs/reference/concepts/provider) and the [web SDK](https://openfeature.dev/docs/reference/technologies/client/web/). - -## Verify - -The integration is tested by evaluating a feature flag with your OpenFeature SDK before capturing an exception. - -```JavaScript -import * as Sentry from '@sentry/browser'; -import { OpenFeature } from '@openfeature/web-sdk'; - -// Evaluate a flag with a default value. If you added the hook to a client in -// the Configure step, make sure to use the same client here. -const client = OpenFeature.getClient(); -const result = client.getBooleanValue('hello', false); - -Sentry.captureException(new Error("Something went wrong!")) -``` - -Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". +Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false". diff --git a/platform-includes/configuration/featureflags/javascript.angular.mdx b/platform-includes/configuration/featureflags/javascript.angular.mdx new file mode 100644 index 0000000000000..16d87819306c2 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.angular.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/angular'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.astro.mdx b/platform-includes/configuration/featureflags/javascript.astro.mdx new file mode 100644 index 0000000000000..f35f07bd7d69e --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.astro.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/astro'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.ember.mdx b/platform-includes/configuration/featureflags/javascript.ember.mdx new file mode 100644 index 0000000000000..f354e73558633 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.ember.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/ember'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.gatsby.mdx b/platform-includes/configuration/featureflags/javascript.gatsby.mdx new file mode 100644 index 0000000000000..b7b37fe0901fc --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.gatsby.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/gatsby'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.mdx b/platform-includes/configuration/featureflags/javascript.mdx new file mode 100644 index 0000000000000..e42935801bed6 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/browser'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.nextjs.mdx b/platform-includes/configuration/featureflags/javascript.nextjs.mdx new file mode 100644 index 0000000000000..53c79e361583b --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.nextjs.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/nextjs'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.nuxt.mdx b/platform-includes/configuration/featureflags/javascript.nuxt.mdx new file mode 100644 index 0000000000000..5ce78aaf385da --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.nuxt.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/nuxt'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.react.mdx b/platform-includes/configuration/featureflags/javascript.react.mdx new file mode 100644 index 0000000000000..c2429e713f227 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.react.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/react'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.remix.mdx b/platform-includes/configuration/featureflags/javascript.remix.mdx new file mode 100644 index 0000000000000..27d3e901dcbfa --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.remix.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/remix'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.solid.mdx b/platform-includes/configuration/featureflags/javascript.solid.mdx new file mode 100644 index 0000000000000..d7cb038bea623 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.solid.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/solid'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.solidstart.mdx b/platform-includes/configuration/featureflags/javascript.solidstart.mdx new file mode 100644 index 0000000000000..893696a256bb4 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.solidstart.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/solidstart'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.svelte.mdx b/platform-includes/configuration/featureflags/javascript.svelte.mdx new file mode 100644 index 0000000000000..7ac6a5a03c3cd --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.svelte.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/svelte'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.sveltekit.mdx b/platform-includes/configuration/featureflags/javascript.sveltekit.mdx new file mode 100644 index 0000000000000..98026634ce36a --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.sveltekit.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/sveltekit'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/featureflags/javascript.vue.mdx b/platform-includes/configuration/featureflags/javascript.vue.mdx new file mode 100644 index 0000000000000..b7ce140ce2d42 --- /dev/null +++ b/platform-includes/configuration/featureflags/javascript.vue.mdx @@ -0,0 +1,17 @@ +```typescript +import * as Sentry from '@sentry/vue'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.featureFlagsIntegration()] +}); + +const flagsIntegration = Sentry.getClient()? + .getIntegrationByName('FeatureFlags'); +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.angular.mdx b/platform-includes/configuration/launchdarkly/javascript.angular.mdx new file mode 100644 index 0000000000000..41cb3f7a43a13 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.angular.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/angular'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.astro.mdx b/platform-includes/configuration/launchdarkly/javascript.astro.mdx new file mode 100644 index 0000000000000..c7b5c0ae3e631 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.astro.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/astro'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.ember.mdx b/platform-includes/configuration/launchdarkly/javascript.ember.mdx new file mode 100644 index 0000000000000..e4d7af31a2f26 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.ember.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/ember'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.gatsby.mdx b/platform-includes/configuration/launchdarkly/javascript.gatsby.mdx new file mode 100644 index 0000000000000..2a2c1524a0afc --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.gatsby.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/gatsby'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.mdx b/platform-includes/configuration/launchdarkly/javascript.mdx new file mode 100644 index 0000000000000..e2c5d22036f80 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/browser'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.nextjs.mdx b/platform-includes/configuration/launchdarkly/javascript.nextjs.mdx new file mode 100644 index 0000000000000..0f3a712f63c44 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.nextjs.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/nextjs'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.nuxt.mdx b/platform-includes/configuration/launchdarkly/javascript.nuxt.mdx new file mode 100644 index 0000000000000..a14f1ac217fd6 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.nuxt.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/nuxt'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.react.mdx b/platform-includes/configuration/launchdarkly/javascript.react.mdx new file mode 100644 index 0000000000000..5110fad9694cb --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.react.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/react'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.remix.mdx b/platform-includes/configuration/launchdarkly/javascript.remix.mdx new file mode 100644 index 0000000000000..86ba7e174961b --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.remix.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/remix'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.solid.mdx b/platform-includes/configuration/launchdarkly/javascript.solid.mdx new file mode 100644 index 0000000000000..540b632995312 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.solid.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/solid'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.solidstart.mdx b/platform-includes/configuration/launchdarkly/javascript.solidstart.mdx new file mode 100644 index 0000000000000..5b6fb92aededc --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.solidstart.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/solidstart'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.svelte.mdx b/platform-includes/configuration/launchdarkly/javascript.svelte.mdx new file mode 100644 index 0000000000000..093c1329faef0 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.svelte.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/svelte'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.sveltekit.mdx b/platform-includes/configuration/launchdarkly/javascript.sveltekit.mdx new file mode 100644 index 0000000000000..ef75d7eda3b94 --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.sveltekit.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/sveltekit'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/launchdarkly/javascript.vue.mdx b/platform-includes/configuration/launchdarkly/javascript.vue.mdx new file mode 100644 index 0000000000000..7051982c3f56d --- /dev/null +++ b/platform-includes/configuration/launchdarkly/javascript.vue.mdx @@ -0,0 +1,22 @@ +Before using this integration, you need to install and instrument the [LaunchDarkly SDK](https://www.npmjs.com/package/launchdarkly-js-client-sdk) in your app. Learn more by reading [LaunchDarkly's docs](https://docs.launchdarkly.com/sdk/client-side/javascript). + +```javascript +import * as Sentry from '@sentry/vue'; +import * as LaunchDarkly from 'launchdarkly-js-client-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.launchDarklyIntegration()] +}); + +const ldClient = LaunchDarkly.initialize( + 'my-client-ID', + {kind: 'user', key: 'my-user-context-key'}, + {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]} +); + +// Evaluate a flag with a default value. You may have to wait for your client to initialize first. +ldClient?.variation('test-flag', false); + +Sentry.captureException(new Error('Something went wrong!')) +``` diff --git a/platform-includes/configuration/openfeature/javascript.angular.mdx b/platform-includes/configuration/openfeature/javascript.angular.mdx new file mode 100644 index 0000000000000..292b2fb415a0f --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.angular.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/angular'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/angular'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.astro.mdx b/platform-includes/configuration/openfeature/javascript.astro.mdx new file mode 100644 index 0000000000000..168429f0986f8 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.astro.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/astro'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/astro'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.ember.mdx b/platform-includes/configuration/openfeature/javascript.ember.mdx new file mode 100644 index 0000000000000..10b6769b46068 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.ember.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/ember'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/ember'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.gatsby.mdx b/platform-includes/configuration/openfeature/javascript.gatsby.mdx new file mode 100644 index 0000000000000..1e748624b99f6 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.gatsby.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/gatsby'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/gatsby'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.mdx b/platform-includes/configuration/openfeature/javascript.mdx new file mode 100644 index 0000000000000..1af6993885a4f --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/browser'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/browser'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.nextjs.mdx b/platform-includes/configuration/openfeature/javascript.nextjs.mdx new file mode 100644 index 0000000000000..d4ef4386be109 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.nextjs.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/nextjs'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/nextjs'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.nuxt.mdx b/platform-includes/configuration/openfeature/javascript.nuxt.mdx new file mode 100644 index 0000000000000..adea8c92c6fc2 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.nuxt.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/nuxt'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/nuxt'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.react.mdx b/platform-includes/configuration/openfeature/javascript.react.mdx new file mode 100644 index 0000000000000..0d94859a01e10 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.react.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/react'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/react'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.remix.mdx b/platform-includes/configuration/openfeature/javascript.remix.mdx new file mode 100644 index 0000000000000..a1a415818239f --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.remix.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/remix'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/remix'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.solid.mdx b/platform-includes/configuration/openfeature/javascript.solid.mdx new file mode 100644 index 0000000000000..b387e991ecab1 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.solid.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/solid'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/solid'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.solidstart.mdx b/platform-includes/configuration/openfeature/javascript.solidstart.mdx new file mode 100644 index 0000000000000..aec820c77cb86 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.solidstart.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/solidstart'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/solidstart'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.svelte.mdx b/platform-includes/configuration/openfeature/javascript.svelte.mdx new file mode 100644 index 0000000000000..7af396ca9303b --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.svelte.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/svelte'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/svelte'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.sveltekit.mdx b/platform-includes/configuration/openfeature/javascript.sveltekit.mdx new file mode 100644 index 0000000000000..7b37f307bb310 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.sveltekit.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/sveltekit'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/sveltekit'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` diff --git a/platform-includes/configuration/openfeature/javascript.vue.mdx b/platform-includes/configuration/openfeature/javascript.vue.mdx new file mode 100644 index 0000000000000..b3c117394d702 --- /dev/null +++ b/platform-includes/configuration/openfeature/javascript.vue.mdx @@ -0,0 +1,35 @@ +Before using this integration, you need to install and instrument the [OpenFeature SDK](https://www.npmjs.com/package/@openfeature/web-sdk) in your app. Learn more by reading OpenFeature's [SDK docs](https://openfeature.dev/docs/reference/technologies/client/web/) and [provider docs](https://openfeature.dev/docs/reference/concepts/provider). + +```javascript {tabTitle: JavaScript (Track All Evals)} +import * as Sentry from '@sentry/vue'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const client = OpenFeature.getClient(); +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` + +```javascript {tabTitle: JavaScript (Track One Client)} +import * as Sentry from '@sentry/vue'; +import { OpenFeature } from '@openfeature/web-sdk'; + +Sentry.init({ + dsn: '___PUBLIC_DSN___', + integrations: [Sentry.openFeatureIntegration()] +}); + +OpenFeature.setProvider(new MyProviderOfChoice()); +const client = OpenFeature.getClient(); +client.addHooks(new Sentry.OpenFeatureIntegrationHook()); + +const result = client.getBooleanValue('test-flag', false); // evaluate with a default value +Sentry.captureException(new Error('Something went wrong!')); +``` From 9364ddc38844a776e2afed0157e8dff570e6fa82 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:36:21 -0800 Subject: [PATCH 12/12] Update links, name 'Generic Support' --- docs/platforms/javascript/common/feature-flags/index.mdx | 3 +-- docs/platforms/python/feature-flags/index.mdx | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/common/feature-flags/index.mdx b/docs/platforms/javascript/common/feature-flags/index.mdx index 65f4ba0f39b95..cb09a7eda1c56 100644 --- a/docs/platforms/javascript/common/feature-flags/index.mdx +++ b/docs/platforms/javascript/common/feature-flags/index.mdx @@ -33,7 +33,6 @@ description: With Feature Flags, Sentry tracks feature flag evaluations in your Evaluation tracking requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below. - [OpenFeature](/platforms/javascript/configuration/integrations/openfeature/) - [LaunchDarkly](/platforms/javascript/configuration/integrations/launchdarkly/) - -To manually track evaluations through an API, see the custom [FeatureFlags](/platforms/javascript/configuration/integrations/featureflags/) integration. +- [Generic Support](/platforms/javascript/configuration/integrations/featureflags/) - if you use an unsupported or in-house provider, you may manually track evaluations through an API. diff --git a/docs/platforms/python/feature-flags/index.mdx b/docs/platforms/python/feature-flags/index.mdx index 75b471db24967..f715a9529535c 100644 --- a/docs/platforms/python/feature-flags/index.mdx +++ b/docs/platforms/python/feature-flags/index.mdx @@ -16,5 +16,6 @@ Evaluation tracking requires enabling an SDK integration. Integrations are provi - [OpenFeature](/platforms/python/integrations/openfeature/) - [LaunchDarkly](/platforms/python/integrations/launchdarkly/) +- [Generic Support](/platforms/javascript/configuration/integrations/featureflags/) - if you use an unsupported or in-house provider, you may manually track evaluations through an API.