Skip to content

Commit c64ddb1

Browse files
authored
feat(flags): document JS Unleash integration (#12338)
Documents feat(flags/v8): Add Unleash integration sentry-javascript#14948 Released in v8.51.0 Closes getsentry/team-replay#514
1 parent 59b4d6e commit c64ddb1

File tree

14 files changed

+329
-0
lines changed

14 files changed

+329
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Unleash
3+
description: "Learn how to use Sentry with Unleash."
4+
notSupported:
5+
- javascript.aws-lambda
6+
- javascript.azure-functions
7+
- javascript.bun
8+
- javascript.capacitor
9+
- javascript.cloudflare
10+
- javascript.connect
11+
- javascript.cordova
12+
- javascript.deno
13+
- javascript.electron
14+
- javascript.express
15+
- javascript.fastify
16+
- javascript.gcp-functions
17+
- javascript.hapi
18+
- javascript.koa
19+
- javascript.nestjs
20+
- javascript.nodejs
21+
- javascript.wasm
22+
---
23+
24+
<PlatformContent includePath="feature-flags/prerelease-alert" />
25+
26+
<Alert level="info">
27+
28+
This integration only works inside a browser environment. It is only available from a package-based install (e.g. `npm` or `yarn`).
29+
30+
</Alert>
31+
32+
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.**
33+
34+
_Import names: `Sentry.unleashIntegration`_
35+
36+
<PlatformContent includePath="/configuration/unleash" />
37+
38+
Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false".
39+
40+
<PlatformContent includePath="feature-flags/next-steps" />

platform-includes/configuration/integrations/javascript.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@
2727
| [`replayCanvasIntegration`](./replaycanvas) | | | || |
2828
| [`reportingObserverIntegration`](./reportingobserver) | || | | |
2929
| [`sessionTimingIntegration`](./sessiontiming) | | | | ||
30+
| [`unleashIntegration`](./unleash) | | | | ||
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/ember';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/gatsby';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/browser';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/nextjs';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/nuxt';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/react';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/remix';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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).
2+
3+
```javascript
4+
import * as Sentry from '@sentry/solid';
5+
import { UnleashClient } from 'unleash-proxy-client';
6+
7+
Sentry.init({
8+
dsn: '___PUBLIC_DSN___',
9+
integrations: [Sentry.unleashIntegration({unleashClientClass: UnleashClient})],
10+
});
11+
12+
const unleash = new UnleashClient({
13+
url: 'https://<your-unleash-instance>/api/frontend',
14+
clientKey: '<your-client-side-token>',
15+
appName: 'my-webapp',
16+
});
17+
18+
unleash.start();
19+
20+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
21+
unleash.isEnabled('test-flag');
22+
23+
Sentry.captureException(new Error('Something went wrong!'));
24+
```

0 commit comments

Comments
 (0)