Skip to content

Commit cd19082

Browse files
committed
Merge branch 'master' into feat/java-v8-changes
2 parents 9daecb3 + 374e8b1 commit cd19082

File tree

12 files changed

+169
-17
lines changed

12 files changed

+169
-17
lines changed

develop-docs/sdk/miscellaneous/feature-branches.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ If you still want the nice GH diff and have CI run on your changes:
2323

2424
## Alternative solution A (used for Java SDK `8.x.x` branch)
2525

26+
This does not show the full history on each file. The history only works on the full repo. Please try another method.
27+
2628
- Create a PR for merging `main` into `8.x.x`
2729
- Once that PR is merged into `8.x.x` there will still be conflicts shown in the PR for merging `8.x.x` back to `main`
2830
- Do another merge of `main` into `8.x.x` where you accept all changes on the `8.x.x` branch and create an empty merge commit

docs/organization/integrations/feature-flag/generic/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ To set up evaluation tracking, visit the [explore page](/product/explore/feature
1414

1515
To set up generic evaluation tracking, visit one of our supported languages' pages:
1616
* [JavaScript](/platforms/javascript/configuration/integrations/generic/)
17+
* [Python](/platforms/python/feature-flags/#generic-api)
1718

1819
## Change Tracking
1920

docs/organization/integrations/feature-flag/unleash/index.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ description: Learn about Sentry's Unleash integrations.
66

77
## Evaluation Tracking
88

9-
Support for this is coming soon, starting with [Python sentry-sdk](https://pypi.org/project/sentry-sdk/).
9+
Sentry can track flag evaluations as they happen within your application. Flag evaluations will appear in the "Feature Flag" section of the Issue Details page as a table, with "suspect" flag predictions highlighted in yellow. Learn more about how to interact with feature flag insights within the Sentry UI by reading the [Issue Details page documentation](/product/issues/issue-details/#feature-flags).
10+
11+
### Set Up Evaluation Tracking
12+
13+
To set up evaluation tracking, visit one of our supported languages pages:
14+
* [Python](/platforms/python/integrations/feature-flags/unleash/)
1015

1116
## Change Tracking
1217

@@ -20,7 +25,7 @@ Enabling Change Tracking is a three-step process. To get started visit the [feat
2025
- One webhook secret can be registered per provider type.
2126
- Select Unleash in the dropdown that says "Select a provider".
2227
2. **Register the webhook URL**.
23-
- Go to your Unleash homepage and navigate to the `/integrations/` page, which can be found by clicking Integrations on the left-hand sidebar navigation, under the Configure heading.
28+
- Go to your Unleash homepage and navigate to the `/integrations/` page, which can be found by clicking Integrations on the left-hand sidebar navigation, under the Configure heading.
2429
- Select the Webhook option. You should be on the `/integrations/create/webhook/` page.
2530
- Copy the provided Sentry webhook URL in settings and paste it into Unleash within their webhook integration UI.
2631
- Make sure the integration is toggled to Enabled.

docs/platforms/javascript/common/feature-flags/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ description: With Feature Flags, Sentry tracks feature flag evaluations in your
3131
## Enable Evaluation Tracking
3232

3333
Evaluation tracking requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below.
34-
- [OpenFeature](/platforms/javascript/configuration/integrations/openfeature/)
35-
- [LaunchDarkly](/platforms/javascript/configuration/integrations/launchdarkly/)
34+
3635
- [Generic](/platforms/javascript/configuration/integrations/generic/)
36+
- [LaunchDarkly](/platforms/javascript/configuration/integrations/launchdarkly/)
37+
- [OpenFeature](/platforms/javascript/configuration/integrations/openfeature/)
3738

3839
<PlatformContent includePath="feature-flags/enable-change-tracking" />
Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
---
22
title: Set Up Feature Flags
33
sidebar_order: 7000
4-
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.
4+
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.
55
---
66

77
<PlatformContent includePath="feature-flags/prerelease-alert" />
88

9+
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.
10+
11+
912
## Prerequisites
1013

1114
* You have the <PlatformLink to="/">Python SDK installed</PlatformLink>.
1215

1316
## Enable Evaluation Tracking
1417

15-
Evaluation tracking requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below.
18+
Evaluation tracking typically requires enabling an SDK integration. Integrations are provider specific. Documentation for supported providers is listed below.
19+
20+
- [Generic (API)](/platforms/python/feature-flags/#generic-api)
21+
- [LaunchDarkly](/platforms/python/integrations/launchdarkly/)
22+
- [OpenFeature](/platforms/python/integrations/openfeature/)
23+
- [Unleash](/platforms/python/integrations/unleash/)
24+
25+
### Generic API
26+
The generic API allows you to manually track feature flag evaluations. These
27+
evaluations are held in memory, and in the event an error occurs, sent to
28+
Sentry for review and analysis. Specifically, the generic integration enables
29+
users to integrate with proprietary (or otherwise unsupported) feature flagging
30+
solutions. **At the moment, we only support boolean flag evaluations.**
31+
32+
```python
33+
from sentry_sdk.feature_flags import add_feature_flag
34+
35+
add_feature_flag('test-flag', False) # Records an evaluation and its result.
36+
37+
sentry_sdk.capture_exception(Exception("Something went wrong!"))
38+
```
1639

17-
- [OpenFeature](/platforms/python/integrations/feature-flags/openfeature/)
18-
- [LaunchDarkly](/platforms/python/integrations/feature-flags/launchdarkly/)
40+
Go to your Sentry project and confirm that your error event has recorded the feature flag "test-flag" and its value "false".
1941

2042
<PlatformContent includePath="feature-flags/enable-change-tracking" />

docs/platforms/python/integrations/feature-flags/index.mdx

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/platforms/python/integrations/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra
117117
| <LinkWithPlatformIcon platform="python.asyncio" label="asyncio" url="/platforms/python/integrations/asyncio" /> | |
118118
| <LinkWithPlatformIcon platform="python.pure_eval" label="Enhanced Locals" url="/platforms/python/integrations/pure_eval" /> | |
119119
| <LinkWithPlatformIcon platform="python.gnu_backtrace" label="GNU Backtrace" url="/platforms/python/integrations/gnu_backtrace" /> | |
120-
| <LinkWithPlatformIcon platform="python.rust_tracing" label="Rust Tracing" url="/platforms/python/integrations/rust_tracing" /> | |
120+
| <LinkWithPlatformIcon platform="python.rust_tracing" label="Rust Tracing" url="/platforms/python/integrations/rust_tracing" /> | |
121121
| <LinkWithPlatformIcon platform="python.socket" label="Socket" url="/platforms/python/integrations/socket" /> | |
122122
| <LinkWithPlatformIcon platform="python.sys_exit" label="sys.exit" url="/platforms/python/integrations/sys_exit" /> | |
123123
| <LinkWithPlatformIcon platform="python.tryton" label="Tryton" url="/platforms/python/integrations/tryton" /> | |
124+
| <LinkWithPlatformIcon platform="python.typer" label="Typer" url="/platforms/python/integrations/typer" /> | |
124125
| <LinkWithPlatformIcon platform="python.wsgi" label="WSGI" url="/platforms/python/integrations/wsgi" /> | |
125126

126127
### Default Integrations
File renamed without changes.
File renamed without changes.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Typer
3+
description: Learn how to use Sentry to capture Typer exceptions.
4+
---
5+
6+
The `TyperIntegration` captures exceptions raised when using [Typer CLI](https://typer.tiangolo.com/) applications.
7+
8+
## Install
9+
10+
Install Typer and the Sentry Python SDK.
11+
12+
```bash
13+
pip install --upgrade "sentry-sdk" typer
14+
```
15+
16+
## Configure
17+
18+
To enable the `TyperIntegration`, add it to the `integrations` list of your `sentry_sdk.init`.
19+
20+
```python
21+
import sentry_sdk
22+
from sentry_sdk.integrations.typer import TyperIntegration
23+
24+
sentry_sdk.init(
25+
dsn="___PUBLIC_DSN___",
26+
integrations=[TyperIntegration()],
27+
)
28+
```
29+
30+
## Verify
31+
32+
Create a small CLI application:
33+
34+
```python
35+
import typer
36+
import sentry_sdk
37+
from sentry_sdk.integrations.typer import TyperIntegration
38+
39+
sentry_sdk.init(
40+
dsn="___PUBLIC_DSN___",
41+
integrations=[TyperIntegration()],
42+
)
43+
44+
def main():
45+
1 / 0
46+
47+
if __name__ == "__main__":
48+
typer.run(main)
49+
```
50+
51+
When you run this, Sentry will capture the `ZeroDivisionError` from the `main()`
52+
function and you'll be able to see it on [sentry.io](https://sentry.io).

0 commit comments

Comments
 (0)