diff --git a/docs/platforms/python/integrations/aiohttp/aiohttp-client.mdx b/docs/platforms/python/integrations/aiohttp/aiohttp-client.mdx
index f15567ce310a49..4a87b7bda0bc40 100644
--- a/docs/platforms/python/integrations/aiohttp/aiohttp-client.mdx
+++ b/docs/platforms/python/integrations/aiohttp/aiohttp-client.mdx
@@ -9,6 +9,8 @@ Use this integration to create spans for outgoing requests and ensure traces are
This integration also supports AIOHTTP servers. See AIOHTTP server documentation for details.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -16,6 +18,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -35,6 +38,7 @@ import aiohttp
async def main():
sentry_sdk.init(...) # same as above
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
async with aiohttp.ClientSession() as session:
async with session.get("https://sentry.io/") as response:
diff --git a/docs/platforms/python/integrations/aiohttp/index.mdx b/docs/platforms/python/integrations/aiohttp/index.mdx
index 982ae5c774d6cc..243b41516d84f7 100644
--- a/docs/platforms/python/integrations/aiohttp/index.mdx
+++ b/docs/platforms/python/integrations/aiohttp/index.mdx
@@ -14,16 +14,17 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
-
If you're on Python 3.6, you also need the `aiocontextvars` package:
```bash {tabTitle:pip}
pip install "aiocontextvars"
```
+
```bash {tabTitle:uv}
uv add "aiocontextvars"
```
@@ -64,6 +65,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr
## Options
+
+
By adding `AioHttpIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `AioHttpIntegration` to change its behavior:
```python
@@ -106,7 +109,6 @@ The default is `{*range(500, 600)}`, meaning that any `HTTPException` with a sta
Regardless of how `failed_request_status_codes` is set, any exceptions raised by the handler, which are not of type `HTTPException` (or a subclass) are reported to Sentry. For example, if your request handler raises an unhandled `AttributeError`, the `AttributeError` gets reported to Sentry, even if you have set `failed_request_status_codes=set()`.
-
## Supported Versions
- AIOHTTP: 3.4+
diff --git a/docs/platforms/python/integrations/aiomysql/index.mdx b/docs/platforms/python/integrations/aiomysql/index.mdx
index cf20011e3bf23d..8f5c1c759b1100 100644
--- a/docs/platforms/python/integrations/aiomysql/index.mdx
+++ b/docs/platforms/python/integrations/aiomysql/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about importing the aiomysql integration and how it captures
The aiomysql integration captures queries from [aiomysql](https://github.com/aio-libs/aiomysql/) as spans.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -64,13 +67,14 @@ async def main():
db="test",
)
try:
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
async with conn.cursor() as cur:
await cur.execute("SELECT 'Hello World'")
result = await cur.fetchone()
finally:
conn.close()
-
+
asyncio.run(main())
```
diff --git a/docs/platforms/python/integrations/anthropic/index.mdx b/docs/platforms/python/integrations/anthropic/index.mdx
index 5754de743d0664..f146079e551ed8 100644
--- a/docs/platforms/python/integrations/anthropic/index.mdx
+++ b/docs/platforms/python/integrations/anthropic/index.mdx
@@ -9,6 +9,8 @@ Once you've installed this SDK, you can use the Sentry AI Agents Monitoring, a S
Sentry AI Monitoring will automatically collect information about prompts, tools, tokens, and models. Learn more about the [AI Agents Dashboard](/ai/monitoring/agents).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -40,6 +42,7 @@ sentry_sdk.init(...) # same as above
client = Anthropic(api_key="(your Anthropic key)")
def my_llm_stuff():
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="The result of the AI inference"):
print(
client.messages.create(
diff --git a/docs/platforms/python/integrations/arq/index.mdx b/docs/platforms/python/integrations/arq/index.mdx
index 19386244384f7c..c731b7aedcab48 100644
--- a/docs/platforms/python/integrations/arq/index.mdx
+++ b/docs/platforms/python/integrations/arq/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with arq."
The arq integration adds support for the [arq job queue system](https://arq-docs.helpmanual.io/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -36,6 +39,7 @@ async def main():
sentry_sdk.init(...) # same as above
redis = await create_pool(RedisSettings())
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
r = await redis.enqueue_job("add_numbers", 1, 2)
diff --git a/docs/platforms/python/integrations/asgi/index.mdx b/docs/platforms/python/integrations/asgi/index.mdx
index ca947b2014d481..6a8818c9713f09 100644
--- a/docs/platforms/python/integrations/asgi/index.mdx
+++ b/docs/platforms/python/integrations/asgi/index.mdx
@@ -11,28 +11,26 @@ Please check our list of [supported integrations](/platforms/python/integrations
+
+
## Install
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
## Configure
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
diff --git a/docs/platforms/python/integrations/asyncpg/index.mdx b/docs/platforms/python/integrations/asyncpg/index.mdx
index dcae1343a07255..3aa9144b438d6d 100644
--- a/docs/platforms/python/integrations/asyncpg/index.mdx
+++ b/docs/platforms/python/integrations/asyncpg/index.mdx
@@ -6,6 +6,8 @@ description: "Learn about importing the asyncpg integration and how it captures
The `AsyncPGIntegration` captures queries from
[asyncpg](https://github.com/MagicStack/asyncpg), which can be viewed in Sentry's **Performance** page.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -13,6 +15,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -31,6 +34,7 @@ import asyncpg
async def main():
sentry_sdk.init(...) # same as above
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
conn = await asyncpg.connect(DATABASE_URL)
await conn.fetch("SELECT * FROM pg_catalog.pg_tables;")
diff --git a/docs/platforms/python/integrations/aws-lambda/manual-instrumentation/index.mdx b/docs/platforms/python/integrations/aws-lambda/manual-instrumentation/index.mdx
index 4771b81624dd36..ab8e824a3a13c3 100644
--- a/docs/platforms/python/integrations/aws-lambda/manual-instrumentation/index.mdx
+++ b/docs/platforms/python/integrations/aws-lambda/manual-instrumentation/index.mdx
@@ -6,15 +6,14 @@ sidebar_order: 2000
This guide walks you through how to manually add Sentry to your AWS Lambda function by installing the Sentry SDK into your AWS Lambda function packages. While this method takes more effort, it gives you full control of your Sentry setup and manual instrumentation.
-
+
You can also configure this function in one of the two ways described below:
-
- **Without touching your code:**
- This method can be instrumented from the Sentry product by those who have access to the AWS infrastructure and doesn't require that you make any direct updates to the code. See the [AWS Lambda guide](/integrations/cloud-monitoring/aws-lambda/).
+ This method can be instrumented from the Sentry product by those who have access to the AWS infrastructure and doesn't require that you make any direct updates to the code. See the [AWS Lambda guide](/integrations/cloud-monitoring/aws-lambda/).
- **By adding the Sentry Lambda Layer to your function manually:**
- While this is a quick way to add Sentry to your AWS Lambda function, it gives you limited configuration possibilities with environment vars. See AWS Lambda Layer.
+ While this is a quick way to add Sentry to your AWS Lambda function, it gives you limited configuration possibilities with environment vars. See AWS Lambda Layer.
## Install
@@ -31,17 +30,12 @@ pip install --target ./package --upgrade sentry-sdk
Here's how to use the AWS Lambda integration for the Python SDK:
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
@@ -92,7 +86,6 @@ With the AWS Lambda integration enabled, the Python SDK will:
- Automatically report all events from your Lambda Functions.
- Allow you to modify the transaction sample rate using `traces_sample_rate`.
- Automatically include the following event reports:
-
- A link to CloudWatch Logs
- Function details
- `sys.argv` for the function
diff --git a/docs/platforms/python/integrations/aws-lambda/manual-layer/index.mdx b/docs/platforms/python/integrations/aws-lambda/manual-layer/index.mdx
index 40d85ec85a008d..92e8aa348a3f68 100644
--- a/docs/platforms/python/integrations/aws-lambda/manual-layer/index.mdx
+++ b/docs/platforms/python/integrations/aws-lambda/manual-layer/index.mdx
@@ -7,6 +7,8 @@ og_image: /og-images/platforms-python-integrations-aws-lambda-manual-layer.png
This guide walks you through how to add Sentry to your AWS Lambda function by adding the Sentry AWS Lambda layer. This method can be instrumented from the Sentry product by those who have access to the AWS infrastructure and doesn't require that you make any direct updates to the code.
+
+
You can also configure this function in one of the two ways described below:
- **Without touching your code:**
@@ -76,7 +78,6 @@ Add an error to your function and run it. If everything's working properly, it s
This error means that you have `urllib3>=2.0` in you dependencies. The Python runtime used in AWS Lambda is not compatible with urllib3 version 2, because it still uses OpenSSL 1.0.
**Solution:** There are two solutions for this error:
-
- Either use a newer Python runtime for your Lambda function. `urllib3` version 2+ is supported in AWS Lambda from the Python 3.9 Lambda runtime and newer.
- Or pin your dependency of urllib3 to `urllib3<1.27` to make it work with the Python runtime 3.7 and 3.8 used in AWS Lambda.
diff --git a/docs/platforms/python/integrations/bottle/index.mdx b/docs/platforms/python/integrations/bottle/index.mdx
index cd77ca6355b161..50ca24365aecde 100644
--- a/docs/platforms/python/integrations/bottle/index.mdx
+++ b/docs/platforms/python/integrations/bottle/index.mdx
@@ -7,6 +7,8 @@ The Bottle integration adds support for the [Bottle web framework](https://bottl
Currently it works well with the stable version of Bottle (0.12).
However the integration with the development version (0.13) doesn't work properly.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -14,6 +16,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -59,6 +62,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr
## Options
+
+
If you add `BottleIntegration` explicitly to your `sentry_sdk.init()` call you can set options for `BottleIntegration` to change its behavior:
```python
@@ -94,7 +99,6 @@ def myendpoint():
- If you set `transaction_style="endpoint"`, the transaction name will be `"myendpoint"`, since that is the route handler function's name.
- If you set `transaction_style="url"`, the transaction name will be `"/myurl/"`, since that is the URL path.
-
### `failed_request_status_codes`
A `set` of integers that will determine when an [`HTTPResponse`](https://bottlepy.org/docs/dev/api.html#bottle.HTTPResponse), which is raised or returned by the request handler, should be reported to Sentry. The `HTTPResponse` is reported to Sentry if its status code is contained in the `failed_request_status_codes` set.
@@ -109,7 +113,6 @@ The default is `{*range(500, 600)}`, meaning that any `HTTPResponse` with a stat
Regardless of how `failed_request_status_codes` is configured, any non-`HTTPResponse` exceptions raised by the handler are reported to Sentry. For example, if your request handler raises an unhandled `AttributeError`, the `AttributeError` gets reported to Sentry, even if you have set `failed_request_status_codes=set()`.
-
## Supported Versions
- Bottle: 0.12.13+
diff --git a/docs/platforms/python/integrations/celery/index.mdx b/docs/platforms/python/integrations/celery/index.mdx
index 91b0e08a70a38e..29a5e42e74d016 100644
--- a/docs/platforms/python/integrations/celery/index.mdx
+++ b/docs/platforms/python/integrations/celery/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Celery."
The Celery integration adds support for the [Celery Task Queue System](https://docs.celeryq.dev/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -110,6 +113,7 @@ def main():
# Enqueueing a task to be processed by Celery
with sentry_sdk.start_transaction(name="calling-a-celery-task"):
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
result = add.delay(4, 4)
if __name__ == "__main__":
@@ -178,7 +182,6 @@ You can pass the following keyword arguments to `CeleryIntegration()`:
Propagate Sentry tracing information to the Celery task. This makes it possible to link Celery task errors to the function that triggered the task.
If this is set to `False`:
-
- errors in Celery tasks won't be matched to the triggering function.
- your Celery tasks will start a new trace and won't be connected to the trace in the calling function.
diff --git a/docs/platforms/python/integrations/clickhouse-driver/index.mdx b/docs/platforms/python/integrations/clickhouse-driver/index.mdx
index cc4038aeb3f2ff..cecfb707cf04da 100644
--- a/docs/platforms/python/integrations/clickhouse-driver/index.mdx
+++ b/docs/platforms/python/integrations/clickhouse-driver/index.mdx
@@ -7,6 +7,8 @@ The clickhouse-driver integration captures queries from
[clickhouse-driver](https://github.com/mymarilyn/clickhouse-driver) as breadcrumbs and spans.
The integration is available for clickhouse-driver 0.2.0 or later.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -14,6 +16,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -34,6 +37,7 @@ from clickhouse_driver import Client
def main():
sentry_init(...) # same as above
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
client = Client(host=DATABASE_HOST)
client.execute("DROP TABLE IF EXISTS sentry_test")
diff --git a/docs/platforms/python/integrations/django/index.mdx b/docs/platforms/python/integrations/django/index.mdx
index 9e1522bf42dfff..36844cffd53870 100644
--- a/docs/platforms/python/integrations/django/index.mdx
+++ b/docs/platforms/python/integrations/django/index.mdx
@@ -13,6 +13,8 @@ If you're using Python 3.7, Django applications with `channels` 2.0 will be corr
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -20,6 +22,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -29,12 +32,7 @@ uv add sentry-sdk
Choose the features you want to configure, and this guide will show you how:
To configure the Sentry SDK, initialize it in your `settings.py` file:
@@ -112,6 +110,8 @@ The parameter [traces_sample_rate](/platforms/python/configuration/options/#trac
## Options
+
+
By adding `DjangoIntegration` explicitly to your `sentry_sdk.init()` call you can set options for `DjangoIntegration` to change its behavior:
```python
@@ -143,7 +143,6 @@ You can pass the following keyword arguments to `DjangoIntegration()`:
- `transaction_style`:
How to name transactions that show up in Sentry tracing.
-
- `"/myproject/myview/"` if you set `transaction_style="url"`.
- `"myproject.myview"` if you set `transaction_style="function_name"`.
@@ -181,9 +180,7 @@ You can pass the following keyword arguments to `DjangoIntegration()`:
(Note that `OPTIONS` and `HEAD` are missing by default.)
-
- The `http_methods_to_capture` option.
-
+ The `http_methods_to_capture` option.
## Supported Versions
diff --git a/docs/platforms/python/integrations/falcon/index.mdx b/docs/platforms/python/integrations/falcon/index.mdx
index 7a192fbbb0a610..98c292eb6db4ee 100644
--- a/docs/platforms/python/integrations/falcon/index.mdx
+++ b/docs/platforms/python/integrations/falcon/index.mdx
@@ -6,6 +6,8 @@ description: "Learn about using Sentry with Falcon."
The Falcon integration adds support for the [Falcon web framework](https://falconframework.org/).
The integration has been confirmed to work with Falcon 1.4 and 2.0.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -13,6 +15,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -60,6 +63,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr
## Options
+
+
By adding `FalconIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `FalconIntegration` to change its behavior:
```python
@@ -91,7 +96,6 @@ You can pass the following keyword arguments to `FalconIntegration()`:
```
In the above code, you would set the transaction to:
-
- `/myurl/b48a7686-ad8c-4c94-8c3b-412ec7f25db2123` if you set `transaction_style="path"`.
- `/myurl/{message_id}` if you set `transaction_style="uri_template"`
diff --git a/docs/platforms/python/integrations/fastapi/index.mdx b/docs/platforms/python/integrations/fastapi/index.mdx
index 6a4afc05dc7e5e..92b14604d161fe 100644
--- a/docs/platforms/python/integrations/fastapi/index.mdx
+++ b/docs/platforms/python/integrations/fastapi/index.mdx
@@ -6,6 +6,8 @@ og_image: /og-images/platforms-python-integrations-fastapi.png
The FastAPI integration adds support for the [FastAPI Framework](https://fastapi.tiangolo.com/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -13,6 +15,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -73,6 +76,8 @@ The parameter [traces_sample_rate](/platforms/python/configuration/options/#trac
## Options
+
+
By adding `FastApiIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `FastApiIntegration` to change its behavior.
Because FastAPI is based on the Starlette framework, both integrations, `StarletteIntegration` and `FastApiIntegration`, must be instantiated.
@@ -128,7 +133,6 @@ You can pass the following keyword arguments to `StarletteIntegration()` and `Fa
```
In the above code, the transaction name will be:
-
- `"/catalog/product/{product_id}"` if you set `transaction_style="url"`
- `"product_detail"` if you set `transaction_style="endpoint"`
@@ -142,7 +146,6 @@ You can pass the following keyword arguments to `StarletteIntegration()` and `Fa
reported to Sentry. Unhandled exceptions that don't have a `status_code` attribute will always be reported to Sentry.
Examples of valid `failed_request_status_codes`:
-
- `{500}` will only send events on HTTP 500.
- `{400, *range(500, 600)}` will send events on HTTP 400 as well as the 5xx range.
- `{500, 503}` will send events on HTTP 500 and 503.
@@ -164,9 +167,7 @@ You can pass the following keyword arguments to `StarletteIntegration()` and `Fa
(Note that `OPTIONS` and `HEAD` are missing by default.)
-
- The `http_methods_to_capture` option.
-
+ The `http_methods_to_capture` option.
## Supported Versions
diff --git a/docs/platforms/python/integrations/flask/index.mdx b/docs/platforms/python/integrations/flask/index.mdx
index 7cfcc4ca0e286b..c712e44c2f5900 100644
--- a/docs/platforms/python/integrations/flask/index.mdx
+++ b/docs/platforms/python/integrations/flask/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Flask."
The Flask integration adds support for the [Flask Web Framework](https://flask.palletsprojects.com).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -59,6 +62,8 @@ After initialization:
## Options
+
+
If you add `FlaskIntegration` explicitly to your `sentry_sdk.init()` call you can set options for `FlaskIntegration` to change its behavior:
```python
@@ -81,7 +86,8 @@ You can pass the following keyword arguments to `FlaskIntegration()`:
- `transaction_style`:
Sets the format or style that transactions are named.
-
+
+
```python
@app.route("/myurl/")
@@ -90,7 +96,6 @@ You can pass the following keyword arguments to `FlaskIntegration()`:
```
In the above code, you would set the transaction to:
-
- `/myurl/` if you set `transaction_style="url"`.
- `myendpoint` if you set `transaction_style="endpoint"`.
@@ -104,9 +109,7 @@ You can pass the following keyword arguments to `FlaskIntegration()`:
(Note that `OPTIONS` and `HEAD` are missing by default.)
-
- The `http_methods_to_capture` option.
-
+ The `http_methods_to_capture` option.
## Supported Versions
diff --git a/docs/platforms/python/integrations/gcp-functions/index.mdx b/docs/platforms/python/integrations/gcp-functions/index.mdx
index f83b64e1df7fba..a686b3e6a27167 100644
--- a/docs/platforms/python/integrations/gcp-functions/index.mdx
+++ b/docs/platforms/python/integrations/gcp-functions/index.mdx
@@ -3,6 +3,8 @@ title: Google Cloud Functions
description: "Learn about using Sentry with Google Cloud Functions."
---
+
+
## Install
Add the Sentry SDK to your `requirements.txt`:
@@ -28,11 +30,7 @@ In addition to capturing errors, you can monitor interactions between multiple s
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
@@ -100,7 +98,6 @@ With the Google Cloud Functions integration enabled, the Python SDK will:
- Automatically report all events from your Cloud Functions
- You can modify the transaction sample rate using `traces_sample_rate`.
- Issues reports automatically include:
-
- A link to the stackdriver logs
- Function details
- `sys.argv` for the function
diff --git a/docs/platforms/python/integrations/google-genai/index.mdx b/docs/platforms/python/integrations/google-genai/index.mdx
index c5652a1a8ffb13..232bb0c5a74c28 100644
--- a/docs/platforms/python/integrations/google-genai/index.mdx
+++ b/docs/platforms/python/integrations/google-genai/index.mdx
@@ -9,6 +9,8 @@ Once you've installed this SDK, you can use the Sentry AI Agents Monitoring, a S
Sentry AI Monitoring will automatically collect information about prompts, tools, tokens, and models. Learn more about the [AI Agents Dashboard](/ai/monitoring/agents).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -58,6 +60,7 @@ sentry_sdk.init(...) # same as above
client = Client(api_key="(your Google API key)")
def my_llm_stuff():
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="The result of the AI inference"):
response = client.models.generate_content(
model="gemini-2.0-flash-exp",
diff --git a/docs/platforms/python/integrations/grpc/index.mdx b/docs/platforms/python/integrations/grpc/index.mdx
index b8da89595d283c..c7100c9f802b1d 100644
--- a/docs/platforms/python/integrations/grpc/index.mdx
+++ b/docs/platforms/python/integrations/grpc/index.mdx
@@ -8,6 +8,8 @@ The [gRPC](https://grpc.io/) integration instruments incoming unary-unary grpc r
Use this integration to start or continue transactions for incoming grpc requests, create spans for outgoing requests,
and ensure traces are properly propagated to downstream services.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -15,6 +17,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -25,17 +28,12 @@ Add `GRPCIntegration()` to your `integrations` list, and enable tracing.
This will add appropriate intercepters to your server/client to capture errors and performance data.
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
### Server
@@ -146,6 +144,7 @@ sentry_sdk.init(...) # same as above
...
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(op="function", name="testing_sentry"):
with grpc.insecure_channel("example.com:12345") as channel:
stub = helloworld_pb2_grpc.GreeterStub(channel)
diff --git a/docs/platforms/python/integrations/httpx/index.mdx b/docs/platforms/python/integrations/httpx/index.mdx
index 5ef294217ade84..a00c6d5827a94c 100644
--- a/docs/platforms/python/integrations/httpx/index.mdx
+++ b/docs/platforms/python/integrations/httpx/index.mdx
@@ -7,6 +7,8 @@ The [HTTPX](https://www.python-httpx.org/) integration instruments outgoing HTTP
Use this integration to create spans for outgoing requests and ensure traces are properly propagated to downstream services.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -14,6 +16,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -31,6 +34,7 @@ import httpx
def main():
sentry_init(...) # same as above
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
r1 = httpx.get("https://sentry.io/")
r2 = httpx.post("http://httpbin.org/post")
diff --git a/docs/platforms/python/integrations/httpx2/index.mdx b/docs/platforms/python/integrations/httpx2/index.mdx
index beb2cba011005c..49068037d90745 100644
--- a/docs/platforms/python/integrations/httpx2/index.mdx
+++ b/docs/platforms/python/integrations/httpx2/index.mdx
@@ -7,6 +7,8 @@ The [HTTPX2](https://httpx2.pydantic.dev/) integration instruments outgoing HTTP
Use this integration to create spans for outgoing requests and ensure traces are properly propagated to downstream services.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -14,6 +16,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -31,6 +34,7 @@ import httpx2
def main():
sentry_init(...) # same as above
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
r1 = httpx2.get("https://sentry.io/")
r2 = httpx2.post("http://httpbin.org/post")
diff --git a/docs/platforms/python/integrations/huey/index.mdx b/docs/platforms/python/integrations/huey/index.mdx
index 8bd1a477a90d20..e34533f8cfb15b 100644
--- a/docs/platforms/python/integrations/huey/index.mdx
+++ b/docs/platforms/python/integrations/huey/index.mdx
@@ -6,6 +6,8 @@ description: "Learn how to import and use the huey integration."
The huey integration adds support for the
[huey task queue library](https://huey.readthedocs.io/en/latest/).
+
+
## Install
To get started, install `sentry-sdk` from PyPI.
@@ -13,6 +15,7 @@ To get started, install `sentry-sdk` from PyPI.
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -36,6 +39,7 @@ huey = SqliteHuey(filename='demo.db')
def add(a, b):
return a + b
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_huey"):
result = add(1, 2)
```
diff --git a/docs/platforms/python/integrations/huggingface_hub/index.mdx b/docs/platforms/python/integrations/huggingface_hub/index.mdx
index d56a152f6f1697..46e7dc23f95ef8 100644
--- a/docs/platforms/python/integrations/huggingface_hub/index.mdx
+++ b/docs/platforms/python/integrations/huggingface_hub/index.mdx
@@ -7,6 +7,8 @@ This integration connects Sentry with [Hugging Face Hub](https://github.com/hugg
Once you've installed this SDK, you can use Sentry AI Agents Monitoring, a Sentry dashboard that helps you understand what's going on with your AI requests. Sentry AI Monitoring will automatically collect information about prompts, tools, tokens, and models. Learn more about the [AI Agents Dashboard](/ai/monitoring/agents).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -72,6 +74,7 @@ def main():
client = InferenceClient(token=HF_TOKEN)
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
response = client.chat_completion(
model="Qwen/Qwen2.5-72B-Instruct",
@@ -87,7 +90,6 @@ if __name__ == "__main__":
main()
```
-
After running this script, the resulting data should show up in the `"AI Spans"` tab on the `"Explore" > "Traces"` page on Sentry.io, and in the [AI Agents Dashboard](/ai/monitoring/agents).
It may take a couple of moments for the data to appear in [sentry.io](https://sentry.io).
diff --git a/docs/platforms/python/integrations/langchain/index.mdx b/docs/platforms/python/integrations/langchain/index.mdx
index b924ab299648ba..81ab1e40abb0d8 100644
--- a/docs/platforms/python/integrations/langchain/index.mdx
+++ b/docs/platforms/python/integrations/langchain/index.mdx
@@ -7,6 +7,8 @@ This integration connects Sentry with [LangChain](https://github.com/langchain-a
Once you've installed this SDK, you can use Sentry AI Agents Monitoring, a Sentry dashboard that helps you understand what's going on with your AI requests. Sentry AI Monitoring will automatically collect information about prompts, tools, tokens, and models. Learn more about the [AI Agents Dashboard](/ai/monitoring/agents).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -78,7 +80,7 @@ def roll_die(sides: int = 6) -> str:
"""Roll a die with a given number of sides"""
return f"Rolled a {random.randint(1, sides)} on a {sides}-sided die."
-
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="langchain-openai"):
model = init_chat_model(
"gpt-4o-mini",
@@ -122,7 +124,7 @@ def roll_die(sides: int = 6) -> str:
"""Roll a die with a given number of sides"""
return f"Rolled a {random.randint(1, sides)} on a {sides}-sided die."
-
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="langchain-anthropic"):
model = init_chat_model(
"claude-3-5-sonnet-20241022",
@@ -198,4 +200,3 @@ You can pass the following keyword arguments to `LangchainIntegration()`:
- OpenAI: 1.0+
- Python: 3.9+
- langchain: 0.1.0+
-
\ No newline at end of file
diff --git a/docs/platforms/python/integrations/langgraph/index.mdx b/docs/platforms/python/integrations/langgraph/index.mdx
index cf41b79a83a9d5..d98d9197ad0f85 100644
--- a/docs/platforms/python/integrations/langgraph/index.mdx
+++ b/docs/platforms/python/integrations/langgraph/index.mdx
@@ -7,6 +7,8 @@ This integration connects Sentry with [LangGraph](https://github.com/langchain-a
Once you've installed this SDK, you can use Sentry AI Agents Monitoring, a Sentry dashboard that helps you understand what's going on with your AI requests. Sentry AI Monitoring will automatically collect information about prompts, tools, tokens, and models. Learn more about the [AI Agents Dashboard](/ai/monitoring/agents).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -21,7 +23,8 @@ uv add sentry-sdk
## Configure
-If you have the `langgraph` package in your dependencies, the LangGraph integration will be enabled automatically when you initialize the Sentry SDK.
+If you have the `langgraph` package in your dependencies, the LangGraph integration will be enabled automatically when you initialize the Sentry SDK.
+
```python
import sentry_sdk
@@ -66,6 +69,7 @@ def should_continue(state: State) -> Literal["tools", END]:
last_message = state["messages"][-1]
return "tools" if getattr(last_message, "tool_calls", None) else END
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="langgraph-openai"):
graph_builder = StateGraph(State)
graph_builder.add_node("chatbot", chatbot)
diff --git a/docs/platforms/python/integrations/litestar/index.mdx b/docs/platforms/python/integrations/litestar/index.mdx
index 90907d4309f3de..9425bd930fdf78 100644
--- a/docs/platforms/python/integrations/litestar/index.mdx
+++ b/docs/platforms/python/integrations/litestar/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Litestar."
The Litestar integration adds support for the [Litestar framework](https://docs.litestar.dev/2/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk uvicorn
```
+
```bash {tabTitle:uv}
uv add sentry-sdk uvicorn
```
@@ -25,11 +28,7 @@ In addition to capturing errors, you can monitor interactions between multiple s
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
diff --git a/docs/platforms/python/integrations/openai/index.mdx b/docs/platforms/python/integrations/openai/index.mdx
index 436d36e60408da..dc81ce1599f873 100644
--- a/docs/platforms/python/integrations/openai/index.mdx
+++ b/docs/platforms/python/integrations/openai/index.mdx
@@ -15,6 +15,8 @@ AI frameworks are moving fast, and so are our integrations. To get the most out
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -48,6 +50,7 @@ sentry_sdk.init(...) # same as above
client = OpenAI(api_key="(your OpenAI key)")
def my_llm_stuff():
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(
name="The result of the AI inference",
op="ai-inference",
diff --git a/docs/platforms/python/integrations/pymongo/index.mdx b/docs/platforms/python/integrations/pymongo/index.mdx
index 1dc082435905e8..9b2f3e5dfbd593 100644
--- a/docs/platforms/python/integrations/pymongo/index.mdx
+++ b/docs/platforms/python/integrations/pymongo/index.mdx
@@ -8,6 +8,8 @@ og_image: /og-images/platforms-python-integrations-pymongo.png
The PyMongo integration adds support for [PyMongo](https://www.mongodb.com/docs/drivers/pymongo/), the official MongoDB driver.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -15,6 +17,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -37,6 +40,7 @@ def main():
db = client["sentry_test_db"]
collection = db["sentry_test"]
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
collection.insert_one({"test": "sentry"})
collection.find_one({"test": "sentry"})
diff --git a/docs/platforms/python/integrations/pyramid/index.mdx b/docs/platforms/python/integrations/pyramid/index.mdx
index 779e16109b395c..bdba5095913012 100644
--- a/docs/platforms/python/integrations/pyramid/index.mdx
+++ b/docs/platforms/python/integrations/pyramid/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Pyramid."
The Pyramid integration adds support for the [Pyramid Web Framework](https://trypyramid.com/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -54,7 +57,6 @@ When you point your browser to [http://localhost:6543/](http://localhost:6543/)
- The Sentry Python SDK will install the Pyramid integration for all of your apps. The integration hooks into Pyramid itself, not any of your apps specifically.
- The SDK will report all exceptions leading to an Internal Server Error. These two kinds of exceptions are:
-
- exceptions that are not handled by any exception view
- exceptions whose exception view returns a status code of 500 (Pyramid version 1.9+ only)
@@ -68,6 +70,8 @@ When you point your browser to [http://localhost:6543/](http://localhost:6543/)
## Options
+
+
By adding `PyramidIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `PyramidIntegration` to change its behavior:
```python
@@ -94,7 +98,6 @@ You can pass the following keyword arguments to `PyramidIntegration()`:
```
In the above code, you can set the transaction to:
-
- `/myurl/{id}` if you set `transaction_style="route_pattern"`
- `myroute` if you set `transaction_style="route_name"`
diff --git a/docs/platforms/python/integrations/pyreqwest/index.mdx b/docs/platforms/python/integrations/pyreqwest/index.mdx
index f391fbf23d7908..cf5f633222a093 100644
--- a/docs/platforms/python/integrations/pyreqwest/index.mdx
+++ b/docs/platforms/python/integrations/pyreqwest/index.mdx
@@ -7,6 +7,8 @@ The [pyreqwest](https://markussintonen.github.io/pyreqwest/pyreqwest.html) integ
Use this integration to create spans for outgoing requests and ensure traces are properly propagated to downstream services.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -14,6 +16,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -54,10 +57,11 @@ def example_sync():
with SyncClientBuilder().error_for_status(True).build() as client:
response = client.get("http://example.com").build().send()
-
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="pyreqwest async"):
asyncio.run(example_async())
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="pyreqwest sync"):
example_sync()
diff --git a/docs/platforms/python/integrations/quart/index.mdx b/docs/platforms/python/integrations/quart/index.mdx
index 097133d8eb6dd8..af01fa749908cf 100644
--- a/docs/platforms/python/integrations/quart/index.mdx
+++ b/docs/platforms/python/integrations/quart/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Quart."
The Quart integration adds support for the [Quart Web Framework](https://gitlab.com/pgjones/quart).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
diff --git a/docs/platforms/python/integrations/ray/index.mdx b/docs/platforms/python/integrations/ray/index.mdx
index 0d862e0de9d34f..06d180b2c8438d 100644
--- a/docs/platforms/python/integrations/ray/index.mdx
+++ b/docs/platforms/python/integrations/ray/index.mdx
@@ -5,6 +5,8 @@ description: "Learn how to import and use the Ray integration."
The Ray integration adds support for the [Ray](https://www.ray.io/) unified compute framework.
+
+
## Install
To get started, install `sentry-sdk` from PyPI.
@@ -12,6 +14,7 @@ To get started, install `sentry-sdk` from PyPI.
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -20,7 +23,6 @@ uv add "sentry-sdk"
Add `RayIntegration()` to your `integrations` list:
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
@@ -88,6 +90,7 @@ ray.init(
def divide(a, b):
return a/b
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="ray-test"):
futures = [
divide.remote(10, 5),
diff --git a/docs/platforms/python/integrations/redis/index.mdx b/docs/platforms/python/integrations/redis/index.mdx
index 7864e975b0d4a5..78159c821a584f 100644
--- a/docs/platforms/python/integrations/redis/index.mdx
+++ b/docs/platforms/python/integrations/redis/index.mdx
@@ -5,11 +5,14 @@ description: "Learn about importing the Redis integration."
The [Redis](https://redis.io/) integration hooks into the [Redis client for Python](https://pypi.org/project/redis/) and logs all Redis commands as breadcrumbs.
+
+
## Install
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -31,6 +34,7 @@ def main():
sentry_sdk.init(...) # same as above
r = redis.Redis(host='localhost', port=6379, decode_responses=True)
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
r.set("foo", "bar")
r.get("foo")
@@ -47,6 +51,7 @@ def main():
sentry_sdk.init(...) # same as above
rc = RedisCluster(host='localhost', port=16379)
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
rc.set("foo", "bar")
rc.get("foo")
@@ -64,6 +69,7 @@ async def main():
sentry_sdk.init(...) # same as above
r = redis.Redis(host='localhost', port=6379)
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
await r.set("foo", "bar")
await r.get("foo")
@@ -102,6 +108,7 @@ sentry_sdk.init(
],
)
```
+
You can pass the following keyword arguments to `RedisIntegration()`:
- `max_data_size`
@@ -118,7 +125,6 @@ You can specify a list of prefixes to Redis keys to define a key space that shou
For example, if you, set `cache_prefixes` to `["template.cache", "middleware.cache"]`, then access to all Redis keys starting with `template.cache` or `middleware.cache` will show up in your cache-monitoring dashboard.
-
## Supported Versions
- Python: 3.6+
diff --git a/docs/platforms/python/integrations/rq/index.mdx b/docs/platforms/python/integrations/rq/index.mdx
index c76308e5c67228..cccc8d3a0aba94 100644
--- a/docs/platforms/python/integrations/rq/index.mdx
+++ b/docs/platforms/python/integrations/rq/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with RQ."
The RQ integration adds support for the [RQ job queue system](https://python-rq.org/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -22,17 +25,12 @@ If you have the `rq` package in your dependencies, the RQ integration will be en
Create a file called `mysettings.py` with the following content:
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python {filename:mysettings.py}
@@ -73,7 +71,6 @@ Generally, make sure that the **call to `init` is loaded on worker startup**, an
In addition, make sure that **`init` is called only once** in your app. For example, if you have a `Flask` app and a worker that depends on the app, we recommend only initializing Sentry once. Note that because the Flask integration is enabled automatically, you don't need to change the configuration shown above.
-
```python {filename:app.py}
# app.py
import sentry_sdk
@@ -181,6 +178,8 @@ sentry_sdk.init(
)
q = Queue(connection=Redis())
+
+# or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
result = q.enqueue(hello, "World")
```
diff --git a/docs/platforms/python/integrations/sanic/index.mdx b/docs/platforms/python/integrations/sanic/index.mdx
index f8a5eb8f998f2e..cea79d6e62ba63 100644
--- a/docs/platforms/python/integrations/sanic/index.mdx
+++ b/docs/platforms/python/integrations/sanic/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Sanic."
The Sanic integration adds support for the [Sanic Web Framework](https://sanic.dev/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -21,6 +24,7 @@ If you're on Python 3.6, you also need the `aiocontextvars` package:
```bash {tabTitle:pip}
pip install "aiocontextvars"
```
+
```bash {tabTitle:uv}
uv add "aiocontextvars"
```
@@ -33,17 +37,12 @@ To ensure that errors occurring in background tasks get reported to Sentry, we a
The example below demonstrates the simplest recommended setup.
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
diff --git a/docs/platforms/python/integrations/socket/index.mdx b/docs/platforms/python/integrations/socket/index.mdx
index 312c94135f8d97..62d3b118e64a3e 100644
--- a/docs/platforms/python/integrations/socket/index.mdx
+++ b/docs/platforms/python/integrations/socket/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about the Socket integration and how it adds support network
Use this integration to create spans for DNS resolves and socket connection creations.
+
+
## Install
Install `sentry-sdk`` from PyPI.
@@ -12,6 +14,7 @@ Install `sentry-sdk`` from PyPI.
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -20,17 +23,12 @@ uv add "sentry-sdk"
Add `SocketIntegration()` to your `integrations` list:
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
@@ -68,6 +66,8 @@ import socket
def main():
sentry_init(...) # same as above
+
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
timeout = 10
socket.getaddrinfo("sentry.io", 443)
diff --git a/docs/platforms/python/integrations/sqlalchemy/index.mdx b/docs/platforms/python/integrations/sqlalchemy/index.mdx
index c3f93600ecea63..80f2b2f663888b 100644
--- a/docs/platforms/python/integrations/sqlalchemy/index.mdx
+++ b/docs/platforms/python/integrations/sqlalchemy/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about importing the SQLAlchemy integration and how it captur
The SQLAlchemy integration captures queries from [SQLAlchemy](https://www.sqlalchemy.org/) as breadcrumbs and spans.
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -35,6 +38,7 @@ def main():
statement = text("SELECT 'Hello World'")
with engine.connect() as conn:
+ # or sentry_sdk.traces.start_span(name="your_span_name", parent_span=None) in stream mode
with sentry_sdk.start_transaction(name="testing_sentry"):
result = conn.execute(statement)
diff --git a/docs/platforms/python/integrations/starlette/index.mdx b/docs/platforms/python/integrations/starlette/index.mdx
index cfe39b271114fa..cc089ef580f941 100644
--- a/docs/platforms/python/integrations/starlette/index.mdx
+++ b/docs/platforms/python/integrations/starlette/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Starlette."
The Starlette integration adds support for the [Starlette Framework](https://www.starlette.io/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -52,6 +55,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr
## Options
+
+
By adding `StarletteIntegration` explicitly to your `sentry_sdk.init()` call you can set options for `StarletteIntegration` to change its behavior:
```python
@@ -84,7 +89,6 @@ You can pass the following keyword arguments to `StarletteIntegration()`:
```
In the above code, the transaction name will be:
-
- `"/catalog/product/{product_id}"` if you set `transaction_style="url"`.
- `"product_detail"` if you set `transaction_style="endpoint"`
@@ -98,7 +102,6 @@ You can pass the following keyword arguments to `StarletteIntegration()`:
reported to Sentry. Unhandled exceptions that don't have a `status_code` attribute will always be reported to Sentry.
Examples of valid `failed_request_status_codes`:
-
- `{500}` will only send events on HTTP 500.
- `{400, *range(500, 600)}` will send events on HTTP 400 as well as the 5xx range.
- `{500, 503}` will send events on HTTP 500 and 503.
@@ -120,9 +123,7 @@ You can pass the following keyword arguments to `StarletteIntegration()`:
(Note that `OPTIONS` and `HEAD` are missing by default.)
-
- The `http_methods_to_capture` option.
-
+ The `http_methods_to_capture` option.
## Supported Versions
diff --git a/docs/platforms/python/integrations/starlite/index.mdx b/docs/platforms/python/integrations/starlite/index.mdx
index b55a7ce427bb76..99f6a8f7b027e1 100644
--- a/docs/platforms/python/integrations/starlite/index.mdx
+++ b/docs/platforms/python/integrations/starlite/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Starlite."
The Starlite integration adds support for the [Starlite framework](https://docs.litestar.dev/1/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk uvicorn
```
+
```bash {tabTitle:uv}
uv add sentry-sdk uvicorn
```
diff --git a/docs/platforms/python/integrations/strawberry/index.mdx b/docs/platforms/python/integrations/strawberry/index.mdx
index 973d1fb1ee0fce..b5b8f610e873f8 100644
--- a/docs/platforms/python/integrations/strawberry/index.mdx
+++ b/docs/platforms/python/integrations/strawberry/index.mdx
@@ -7,6 +7,8 @@ The Strawberry integration captures errors and operations from the
[Strawberry GraphQL library](https://strawberry.rocks/), which can then be viewed
in [Sentry](https://sentry.io).
+
+
## Install
To get started, install `sentry-sdk` from PyPI.
@@ -14,6 +16,7 @@ To get started, install `sentry-sdk` from PyPI.
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
@@ -27,11 +30,7 @@ Select which Sentry features you'd like to install in addition to Error Monitori
Add `StrawberryIntegration()` to your `integrations` list:
```python
diff --git a/docs/platforms/python/integrations/tornado/index.mdx b/docs/platforms/python/integrations/tornado/index.mdx
index 615065c70ef8ce..03289a2e6171c8 100644
--- a/docs/platforms/python/integrations/tornado/index.mdx
+++ b/docs/platforms/python/integrations/tornado/index.mdx
@@ -5,6 +5,8 @@ description: "Learn about using Sentry with Tornado."
The Tornado integration adds support for the [Tornado Web Framework](https://www.tornadoweb.org/).
+
+
## Install
Install `sentry-sdk` from PyPI:
@@ -12,6 +14,7 @@ Install `sentry-sdk` from PyPI:
```bash {tabTitle:pip}
pip install sentry-sdk
```
+
```bash {tabTitle:uv}
uv add sentry-sdk
```
@@ -21,6 +24,7 @@ If you're on Python 3.6, you also need the `aiocontextvars` package:
```bash {tabTitle:pip}
pip install "aiocontextvars"
```
+
```bash {tabTitle:uv}
uv add "aiocontextvars"
```
diff --git a/docs/platforms/python/integrations/wsgi/index.mdx b/docs/platforms/python/integrations/wsgi/index.mdx
index e16bdc08418451..f4b08041dece30 100644
--- a/docs/platforms/python/integrations/wsgi/index.mdx
+++ b/docs/platforms/python/integrations/wsgi/index.mdx
@@ -8,30 +8,29 @@ If you use a WSGI framework not directly supported by the SDK, or wrote a raw WS
Please check our list of [supported integrations](/platforms/python/integrations/) as there might already be a specific integration (like [Django](/platforms/python/integrations/django/) or [Flask](/platforms/python/integrations/flask/)) that is easier to use and captures more useful information than our generic WSGI middleware. If that's the case, you should use the specific integration instead of this middleware.
+
+
+
## Install
```bash {tabTitle:pip}
pip install "sentry-sdk"
```
+
```bash {tabTitle:uv}
uv add "sentry-sdk"
```
## Configure
-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
```python
diff --git a/includes/python-stream-mode-general-callout.mdx b/includes/python-stream-mode-general-callout.mdx
new file mode 100644
index 00000000000000..413e55216caaf8
--- /dev/null
+++ b/includes/python-stream-mode-general-callout.mdx
@@ -0,0 +1,5 @@
+
+
+If you're using stream mode, this page's references to "transaction" refer to service spans instead. See New Spans for more information.
+
+
diff --git a/includes/python-stream-mode-integration-option-callout.mdx b/includes/python-stream-mode-integration-option-callout.mdx
new file mode 100644
index 00000000000000..f4b8df9ac58c53
--- /dev/null
+++ b/includes/python-stream-mode-integration-option-callout.mdx
@@ -0,0 +1,5 @@
+
+
+In stream mode, these options still work as described, but apply to service spans instead of transactions.
+
+