Skip to content

Commit ab4356f

Browse files
committed
Wording
2 parents 9c445d3 + f7c670a commit ab4356f

File tree

4 files changed

+551
-462
lines changed

4 files changed

+551
-462
lines changed

docs/platforms/javascript/common/configuration/integrations/launchdarkly.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ This integration only works inside a browser environment.
2929

3030
</Alert>
3131

32-
The [LaunchDarkly](https://launchdarkly.com/) integration tracks feature flag evaluations produced by the LaunchDarkly SDK. These evaluations are held in memory and sent to Sentry for review and analysis if an error occurs. **At the moment, we only support boolean flag evaluations.**
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.**
3333

34-
_Import name: `Sentry.launchDarklyIntegration` and `Sentry.buildLaunchDarklyFlagUsedHandler`_
34+
_Import names: `Sentry.launchDarklyIntegration` and `Sentry.buildLaunchDarklyFlagUsedHandler`_
35+
36+
## Install
37+
38+
Install [`@sentry/browser`](https://www.npmjs.com/package/@sentry/browser) and [`launchdarkly-js-client-sdk`](https://www.npmjs.com/package/launchdarkly-js-client-sdk) from npm.
39+
40+
## Configure
3541

3642
```JavaScript
3743
import * as Sentry from '@sentry/browser';
@@ -47,9 +53,25 @@ const ldClient = LaunchDarkly.initialize(
4753
{kind: 'user', key: 'my-user-context-key'},
4854
{inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]}
4955
);
50-
const flagVal = ldClient.variation('my-flag', false); // evaluates a flag
5156
```
5257

53-
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 can reuse this setup code for React and client-side Node.js.
58+
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).
59+
60+
## Verify
61+
62+
The integration is tested by evaluating a feature flag with your LaunchDarkly SDK before capturing an exception.
63+
64+
```JavaScript
65+
import * as Sentry from '@sentry/browser';
66+
import * as LaunchDarkly from 'launchdarkly-js-client-sdk';
67+
68+
// Evaluate a flag with a default value, with the ldClient from the Configure step.
69+
// You may have to wait for your client to initialize before doing this.
70+
ldClient?.variation("hello", false);
71+
72+
Sentry.captureException(Exception("Something went wrong!"))
73+
```
74+
75+
Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". For a full end-to-end test, you must create the flag and a targeting rule in LaunchDarkly. Learn more about the LaunchDarkly SDK [here](https://docs.launchdarkly.com/sdk/client-side/javascript).
5476
5577
<PlatformContent includePath="feature-flags/next-steps" />

docs/platforms/javascript/common/configuration/integrations/openfeature.mdx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ This integration only works inside a browser environment.
2929

3030
</Alert>
3131

32+
The [OpenFeature](https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature 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+
3234
_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_
3335

34-
The [OpenFeature](https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and sent to Sentry for review and analysis if an error occurs. **At the moment, we only support boolean flag evaluations.**
36+
## Install
37+
38+
Install [`@sentry/browser`](https://www.npmjs.com/package/@sentry/browser) and [`@openfeature/web-sdk`](https://www.npmjs.com/package/@openfeature/web-sdk) from npm.
39+
40+
## Configure
3541

3642
```JavaScript
3743
import * as Sentry from '@sentry/browser';
@@ -42,13 +48,34 @@ Sentry.init({
4248
integrations: [Sentry.openFeatureIntegration()]
4349
});
4450

51+
OpenFeature.setProvider(new MyProviderOfChoice());
52+
53+
// Option 1: track all OpenFeature evaluations.
54+
OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());
55+
56+
// Option 2: only track evaluations by a specific client.
4557
const client = OpenFeature.getClient();
4658
client.addHooks(new Sentry.OpenFeatureIntegrationHook());
59+
```
60+
61+
Learn more about OpenFeature providers [here](https://openfeature.dev/docs/reference/concepts/provider).
62+
63+
## Verify
64+
65+
The integration is tested by evaluating a feature flag with your OpenFeature SDK before capturing an exception.
66+
67+
```JavaScript
68+
import * as Sentry from '@sentry/browser';
69+
import { OpenFeature } from '@openfeature/web-sdk';
70+
71+
// Evaluate a flag with a default value. If you added the hook to a client in
72+
// the Configure step, make sure to use the same client here.
73+
const client = OpenFeature.getClient();
74+
const result = client.getBooleanValue('hello', false);
4775

48-
// Evaluating flags will record the result on the Sentry client.
49-
const result = client.getBooleanValue('my-flag', false);
76+
Sentry.captureException(Exception("Something went wrong!"))
5077
```
5178

52-
Learn more about the [OpenFeature SDK](https://github.com/open-feature/js-sdk/tree/main).
79+
Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". Learn more about the OpenFeature SDK at https://github.com/open-feature/js-sdk/tree/main.
5380

5481
<PlatformContent includePath="feature-flags/next-steps" />

src/components/githubCTA/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export function GitHubCTA() {
2626
<div>
2727
<Link href="https://docs.sentry.io/contributing/">How to contribute</Link>{' '}
2828
&nbsp;&nbsp;|&nbsp;&nbsp;
29-
<Link href={sourceUrl}>Edit this page</Link> &nbsp;&nbsp;|&nbsp;&nbsp;
29+
<Link href={sourceUrl}>
30+
Edit this page
31+
</Link> &nbsp;&nbsp;|&nbsp;&nbsp;
3032
<Link href="https://github.com/getsentry/sentry-docs/issues/new/choose">
3133
Create a docs issue
3234
</Link>{' '}

0 commit comments

Comments
 (0)