Skip to content

Commit 344a0c2

Browse files
authored
feat(flags): add browser JS integration docs for Launchdarkly (#11827)
* feat(flags): add browser JS integration docs for Launchdarkly * Review comments * configuration->integration
1 parent 361fd80 commit 344a0c2

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: LaunchDarkly
3+
description: "Attaches recent LaunchDarkly feature flag evaluations to error event context."
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+
<Alert level="info">
25+
26+
This integration only works inside a browser environment.
27+
28+
</Alert>
29+
30+
_Import name: `Sentry.launchDarklyIntegration` and `Sentry.buildLaunchDarklyFlagUsedHandler`_
31+
32+
The [LaunchDarkly](https://launchdarkly.com/) integration tracks feature flag evaluations produced by the LaunchDarkly 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.**
33+
34+
```JavaScript
35+
import * as Sentry from '@sentry/browser';
36+
import * as LaunchDarkly from 'launchdarkly-js-client-sdk';
37+
38+
Sentry.init({integrations: [Sentry.launchDarklyIntegration()]});
39+
40+
const ldClient = LaunchDarkly.initialize(
41+
'my-client-ID',
42+
{kind: 'user', key: 'my-user-context-key'},
43+
{inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]}
44+
);
45+
const flagVal = ldClient.variation('my-flag', false); // evaluates a flag
46+
```
47+
48+
Learn more about the LaunchDarkly SDK at https://docs.launchdarkly.com/sdk/client-side/javascript.
49+
At the moment, **we do not officially support framework-specific LaunchDarkly
50+
SDKs.** However, you may reuse this setup code for React and client-side Node.js.
51+
52+
## Options
53+
54+
There are no setup options for this integration.

0 commit comments

Comments
 (0)