-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(flags): document statsig browser integration #12718
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
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
66c27d3
feat(flags): document statsig browser integration
aliu39 5d6477c
Add /
aliu39 5040d6e
Specify sdk name
aliu39 13030e4
Statsig feature gates
aliu39 3f6c770
Fix node name in notSupported list
aliu39 bc801a5
Improve statsigClient comment
aliu39 b2815ff
Add platform config
aliu39 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
docs/platforms/javascript/common/configuration/integrations/statsig.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: Statsig | ||
description: "Learn how to use Sentry with Statsig." | ||
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 [Statsig](https://www.statsig.com/) integration tracks feature flag evaluations produced by the Statsig 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 from Statsig's `checkGate` method**. Learn more about [feature gates](https://docs.statsig.com/feature-flags/working-with/). | ||
|
||
This integration is available in Sentry SDK **versions 9.0.0 and higher**, or **versions 8.55.0 and higher for v8.** | ||
|
||
_Import name: `Sentry.statsigIntegration`_ | ||
|
||
<PlatformContent includePath="/configuration/statsig" /> | ||
|
||
<PlatformContent includePath="feature-flags/next-steps" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Before using this integration, you need to install and instrument Statsig in your app. Learn more by reading [Statsig's SDK reference](https://docs.statsig.com/client/javascript-sdk) and [quickstart guide](https://docs.statsig.com/guides/first-feature). | ||
|
||
```javascript | ||
import * as Sentry from '@sentry/browser'; | ||
import { StatsigClient } from '@statsig/js-client'; | ||
|
||
const statsigClient = new StatsigClient( YOUR_SDK_KEY, { userID: 'my-user-id' }, {} ); // see SDK reference. | ||
aliu39 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
Sentry.init({ | ||
dsn: '___PUBLIC_DSN___', | ||
integrations: [Sentry.statsigIntegration({featureFlagClient: statsigClient})], | ||
}); | ||
|
||
await statsigClient.initializeAsync(); // or statsigClient.initializeSync(); | ||
|
||
const result = statsigClient.checkGate('my-feature-gate'); | ||
Sentry.captureException(new Error('something went wrong')); | ||
``` | ||
|
||
Visit the Sentry website and confirm that your error event has recorded the feature flag "my-feature-gate" and its value "false". |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.