Skip to content

feat(flags): document JS Unleash integration #12338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Unleash
description: "Learn how to use Sentry with Unleash."
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
---

<PlatformContent includePath="feature-flags/prerelease-alert" />

<Alert level="info">

This integration only works inside a browser environment. It is only available from a package-based install (e.g. `npm` or `yarn`).

</Alert>

The [Unleash](https://www.getunleash.io/) integration tracks feature flag evaluations produced by the Unleash SDK. These evaluations are held in memory, and in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.** This integration is available in Sentry SDK **versions 8.51.0 or higher.**

_Import names: `Sentry.unleashIntegration`_

<PlatformContent includePath="/configuration/unleash" />

Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false".

<PlatformContent includePath="feature-flags/next-steps" />
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
| [`replayCanvasIntegration`](./replaycanvas) | | | | ✓ | |
| [`reportingObserverIntegration`](./reportingobserver) | | ✓ | | | |
| [`sessionTimingIntegration`](./sessiontiming) | | | | | ✓ |
| [`unleashIntegration`](./unleash) | | | | | ✓ |
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.ember.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/ember';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.gatsby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/gatsby';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/browser';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.nextjs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/nextjs';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.nuxt.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/nuxt';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.react.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/react';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.remix.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/remix';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.solid.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/solid';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.solidstart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/solidstart';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.svelte.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/svelte';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.sveltekit.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/sveltekit';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
24 changes: 24 additions & 0 deletions platform-includes/configuration/unleash/javascript.vue.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
import * as Sentry from '@sentry/vue';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```
Loading