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..718234edd9b85 --- /dev/null +++ b/docs/platforms/javascript/common/configuration/integrations/featureflags.mdx @@ -0,0 +1,48 @@ +--- +title: FeatureFlags +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. It is only available from a package-based install (e.g. `npm` or `yarn`). + + + + + +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. + + + +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`_ + + + +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 0559fb739472f..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(Exception("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 28813ad5dd320..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(Exception("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/feature-flags/index.mdx b/docs/platforms/javascript/common/feature-flags/index.mdx index b8bda352ae012..cb09a7eda1c56 100644 --- a/docs/platforms/javascript/common/feature-flags/index.mdx +++ b/docs/platforms/javascript/common/feature-flags/index.mdx @@ -33,5 +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/) +- [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. 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!')); +```