LaunchDarkly

Attaches recent LaunchDarkly feature flag evaluations to error event context.

Import name: Sentry.launchDarklyIntegration and Sentry.buildLaunchDarklyFlagUsedHandler

The LaunchDarkly 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.

Copied
import * as Sentry from '@sentry/browser';
import * as LaunchDarkly from 'launchdarkly-js-client-sdk';

Sentry.init({integrations: [Sentry.launchDarklyIntegration()]});

const ldClient = LaunchDarkly.initialize(
    'my-client-ID',
    {kind: 'user', key: 'my-user-context-key'},
    {inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()]}
);
const flagVal = ldClient.variation('my-flag', false); // evaluates a flag

Learn more about the LaunchDarkly SDK at https://docs.launchdarkly.com/sdk/client-side/javascript. At the moment, we do not officially support framework-specific LaunchDarkly SDKs. However, you may reuse this setup code for React and client-side Node.js.

There are no setup options for this integration.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").