-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flags): re-publish docs on python unleash and generic integratio…
…ns (#12300) This PR re-publishes them and - fixes Unleash sample code (need to call `initialize_client()`) and versioning. - moves python generic docs, after changing it from an integration to an API: getsentry/sentry-python#3917 --------- Co-authored-by: Anton Pirker <[email protected]>
- Loading branch information
1 parent
c81d6f0
commit 4b81e30
Showing
9 changed files
with
113 additions
and
16 deletions.
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
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 |
---|---|---|
@@ -1,20 +1,42 @@ | ||
--- | ||
title: Set Up Feature Flags | ||
sidebar_order: 7000 | ||
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log feature flag changes, and reports any suspicious updates that may have caused an error. | ||
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log of feature flag changes, and reports any suspicious updates that may have caused an error. | ||
--- | ||
|
||
<PlatformContent includePath="feature-flags/prerelease-alert" /> | ||
|
||
A feature flagging integration allows you to manually track feature flag evaluations through an API. These evaluations are collected in memory, and in the event an error occurs, sent to Sentry for review and analysis. | ||
|
||
|
||
## Prerequisites | ||
|
||
* You have the <PlatformLink to="/">Python SDK installed</PlatformLink>. | ||
|
||
## Enable Evaluation Tracking | ||
|
||
Evaluation tracking requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below. | ||
Evaluation tracking typically requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below. | ||
|
||
- [Generic (API)](/platforms/python/feature-flags/#generic-api) | ||
- [LaunchDarkly](/platforms/python/integrations/launchdarkly/) | ||
- [OpenFeature](/platforms/python/integrations/openfeature/) | ||
- [Unleash](/platforms/python/integrations/unleash/) | ||
|
||
### Generic API | ||
The generic API allows you to manually track feature flag evaluations. 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.** | ||
|
||
```python | ||
from sentry_sdk.feature_flags import add_feature_flag | ||
|
||
add_feature_flag('test-flag', False) # Records an evaluation and its result. | ||
|
||
sentry_sdk.capture_exception(Exception("Something went wrong!")) | ||
``` | ||
|
||
- [OpenFeature](/platforms/python/integrations/feature-flags/openfeature/) | ||
- [LaunchDarkly](/platforms/python/integrations/feature-flags/launchdarkly/) | ||
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/enable-change-tracking" /> |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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" /> |
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