-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(flags): re-publish docs on python unleash and generic integrations #12300
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2402fdf
Revert "fix(flags): unpublish docs on unreleased python integrations …
aliu39 76c4010
Update unleash pkg version and sample code
aliu39 cfe959e
Merge branch 'master' of https://github.com/getsentry/sentry-docs int…
aliu39 c89ec77
Move python generic doc from integrations to index page section
aliu39 c3a3ba0
small code snippet fix
antonpirker c8ae402
Made feature flag docs consistent with other integrations
antonpirker 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
This file contains 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 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 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
49 changes: 49 additions & 0 deletions
49
docs/platforms/python/integrations/feature-flags/generic.mdx
This file contains 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,49 @@ | ||
--- | ||
title: Generic | ||
description: "Learn how to attach custom feature flag data to Sentry error events." | ||
--- | ||
|
||
<PlatformContent includePath="feature-flags/prerelease-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. Specifically, the generic integration enables users to integrate with proprietary (or otherwise unsupported) feature flagging solutions. **At the moment, we only support boolean flag evaluations.** | ||
|
||
## Install | ||
|
||
Install `sentry-sdk` from PyPI. | ||
|
||
```bash | ||
pip install --upgrade 'sentry-sdk' | ||
``` | ||
|
||
## Configure | ||
|
||
Add `FeatureFlagsIntegration()` to your `integrations` list: | ||
|
||
```python | ||
import sentry_sdk | ||
from sentry_sdk.integrations.feature_flags import FeatureFlagsIntegration | ||
|
||
sentry_sdk.init( | ||
dsn="___PUBLIC_DSN___", | ||
integrations=[ | ||
FeatureFlagsIntegration(), | ||
], | ||
) | ||
``` | ||
|
||
## Verify | ||
|
||
The integration is tested by calling the `add_feature_flag` API before capturing an exception. | ||
|
||
```python | ||
import sentry_sdk | ||
from sentry_sdk.integrations.feature_flags import add_feature_flag | ||
|
||
add_feature_flag('test-flag', False) | ||
|
||
sentry_sdk.capture_exception(Exception("Something went wrong!")) | ||
``` | ||
|
||
Go to your Sentry project and confirm that your error event has recorded the feature flag "test-flag" and its value "false". | ||
|
||
<PlatformContent includePath="feature-flags/next-steps" /> |
64 changes: 64 additions & 0 deletions
64
docs/platforms/python/integrations/feature-flags/unleash.mdx
This file contains 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,64 @@ | ||
--- | ||
title: Unleash | ||
description: "Learn how to use Sentry with Unleash." | ||
--- | ||
|
||
<PlatformContent includePath="feature-flags/prerelease-alert" /> | ||
|
||
The [Unleash](https://www.getunleash.io/) integration tracks feature flag evaluations produced by the Unleash 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.** | ||
|
||
## Install | ||
|
||
Install `sentry-sdk` (>=2.20.0) and `UnleashClient` (>=6.0.1) from PyPI. | ||
|
||
```bash | ||
pip install --upgrade sentry-sdk UnleashClient | ||
``` | ||
|
||
## Configure | ||
|
||
Add `UnleashIntegration` to your `integrations` list: | ||
|
||
```python | ||
import sentry_sdk | ||
from sentry_sdk.integrations.unleash import UnleashIntegration | ||
|
||
sentry_sdk.init( | ||
dsn="___PUBLIC_DSN___", | ||
integrations=[UnleashIntegration()], | ||
) | ||
``` | ||
|
||
For more information on how to use Unleash, read Unleash's [Python reference](https://docs.getunleash.io/reference/sdks/python) and [quickstart guide](https://docs.getunleash.io/quickstart). | ||
|
||
## Verify | ||
|
||
Test the integration by evaluating a feature flag using your Unleash SDK before capturing an exception. | ||
|
||
```python {tabTitle: Python, using is_enabled} | ||
import sentry_sdk | ||
from UnleashClient import UnleashClient | ||
|
||
unleash = UnleashClient(...) # See Unleash quickstart. | ||
unleash.initialize_client() | ||
|
||
test_flag_enabled = unleash.is_enabled("test-flag") | ||
sentry_sdk.capture_exception(Exception("Something went wrong!")) | ||
``` | ||
|
||
```python {tabTitle: Python, using get_variant} | ||
import sentry_sdk | ||
from UnleashClient import UnleashClient | ||
|
||
unleash = UnleashClient(...) # See Unleash quickstart. | ||
unleash.initialize_client() | ||
|
||
test_flag_variant = unleash.get_variant("test-flag") | ||
test_flag_enabled = test_flag_variant["enabled"] | ||
sentry_sdk.capture_exception(Exception("Something went wrong!")) | ||
``` | ||
|
||
Visit the [Sentry website](https://sentry.io/issues/) and confirm that your error | ||
event has recorded the feature flag "test-flag", and its value is equal to `test_flag_enabled`. | ||
|
||
<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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make the title a little more descriptive here? Like 'Generic Feature Flags' or something like that? Same with the page title for 'Unleash', maybe 'Feature Flags using Unleash'?