Skip to content

Commit 2f1b54f

Browse files
committed
feat(flags): document python FeatureFlagsIntegration for custom flag tracking
1 parent 37cab66 commit 2f1b54f

File tree

1 file changed

+50
-0
lines changed
  • docs/platforms/python/integrations/feature_flags

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Feature Flags
3+
description: "Learn how to attach custom feature flag data to Sentry error events."
4+
---
5+
6+
<PlatformContent includePath="feature-flags/prerelease-alert" />
7+
8+
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.
9+
**At the moment, we only support boolean flag evaluations.**
10+
11+
## Install
12+
13+
Install `sentry-sdk` from PyPI.
14+
15+
```bash
16+
pip install --upgrade 'sentry-sdk'
17+
```
18+
19+
## Configure
20+
21+
Add `FeatureFlagsIntegration()` to your `integrations` list:
22+
23+
```python
24+
import sentry_sdk
25+
from sentry_sdk.integrations.feature_flags import FeatureFlagsIntegration
26+
27+
sentry_sdk.init(
28+
dsn="___PUBLIC_DSN___",
29+
integrations=[
30+
FeatureFlagsIntegration(),
31+
],
32+
)
33+
```
34+
35+
## Verify
36+
37+
The integration is tested by calling the `add_feature_flag` API before capturing an exception.
38+
39+
```python
40+
import sentry_sdk
41+
from sentry_sdk.integrations.feature_flags import add_feature_flag
42+
43+
add_feature_flag('hello', False)
44+
45+
sentry_sdk.capture_exception(Exception("Something went wrong!"))
46+
```
47+
48+
Visit the Sentry website and confirm that your error event has recorded the feature flag "hello" and its value "false".
49+
50+
<PlatformContent includePath="feature-flags/next-steps" />

0 commit comments

Comments
 (0)