-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(flags): document custom featureFlagsIntegration and refactor all JS integration docs #12151
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
+1,092
−84
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fd22a8d
feat(flags): document featureFlagsIntegration for custom flag tracking
aliu39 1f9de9b
Lowercase filename and create python file
aliu39 1c15c37
Del python doc
aliu39 ad16c12
review comment
aliu39 d69649f
keep title consistent w identifier
aliu39 294718d
Rename featureFlags.mdx to featureflags.mdx
aliu39 e0e050d
Keep sentry/browser in code snippet
aliu39 40ce74d
Link from js index
aliu39 2ace216
Link index from integration doc
aliu39 4277118
Fix invalid Exception syntax
aliu39 fb02818
ref(flags): add platform-specific content and refactor JS integration…
aliu39 9364ddc
Update links, name 'Generic Support'
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
70 changes: 70 additions & 0 deletions
70
docs/platforms/javascript/common/configuration/integrations/featureFlags.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,70 @@ | ||
| --- | ||
| title: Feature Flags | ||
| description: "Learn how to attach custom feature flag data to Sentry error events." | ||
| 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. | ||
|
|
||
| </Alert> | ||
|
|
||
| The Feature Flags integration allows you to manually track feature flag evaluations through an API. 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.** | ||
|
|
||
| _Import names: `Sentry.featureFlagsIntegration` and `type Sentry.FeatureFlagsIntegration`_ | ||
|
|
||
| ## Install | ||
|
|
||
| Install your platform's Sentry SDK from npm. | ||
|
|
||
| ## Configure | ||
|
|
||
| ```JavaScript | ||
| import * as Sentry from '@sentry/<your browser platform, e.g. react>'; | ||
aliu39 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| integrations: [Sentry.featureFlagsIntegration()] | ||
| }); | ||
| ``` | ||
|
|
||
| ## Verify | ||
|
|
||
| The integration is tested by calling the `addFeatureFlag` method before capturing an exception. | ||
|
|
||
| ```JavaScript | ||
| import * as Sentry from '@sentry/browser'; | ||
|
|
||
| const flagsIntegration = Sentry.getClient()?.getIntegrationByName<Sentry.FeatureFlagsIntegration>('FeatureFlags'); | ||
| if (flagsIntegration) { | ||
| flagsIntegration.addFeatureFlag('hello', false); | ||
| } else { | ||
| // check your configure step | ||
| } | ||
| Sentry.captureException(Exception('broke')); | ||
aliu39 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false". | ||
aliu39 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <PlatformContent includePath="feature-flags/next-steps" /> | ||
Oops, something went wrong.
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.