Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/platforms/python/integrations/aiohttp/aiohttp-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ Use this integration to create spans for outgoing requests and ensure traces are

This integration also supports AIOHTTP servers. See <PlatformLink to="/integrations/aiohttp/">AIOHTTP server documentation</PlatformLink> for details.

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand All @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions docs/platforms/python/integrations/aiohttp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down Expand Up @@ -64,6 +65,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr

## Options

<Include name="python-stream-mode-integration-option-callout.mdx" />

By adding `AioHttpIntegration` to your `sentry_sdk.init()` call explicitly, you can set options for `AioHttpIntegration` to change its behavior:

```python
Expand Down Expand Up @@ -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+
Expand Down
6 changes: 5 additions & 1 deletion docs/platforms/python/integrations/aiomysql/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ 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.

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand Down Expand Up @@ -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())
```

Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/python/integrations/anthropic/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/python/integrations/arq/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ description: "Learn about using Sentry with arq."

The arq integration adds support for the [arq job queue system](https://arq-docs.helpmanual.io/).

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand All @@ -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)

Expand Down
10 changes: 4 additions & 6 deletions docs/platforms/python/integrations/asgi/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@ Please check our list of [supported integrations](/platforms/python/integrations

</Alert>

<Include name="python-stream-mode-general-callout.mdx" />

## 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.

<OnboardingOptionButtons
options={[
'error-monitoring',
'performance',
'profiling',
]}
options={["error-monitoring", "performance", "profiling"]}
/>

```python
Expand Down
4 changes: 4 additions & 0 deletions docs/platforms/python/integrations/asyncpg/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ 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.

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand All @@ -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;")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.


<Include name="python-stream-mode-general-callout.mdx" />

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 <PlatformLink to="/integrations/aws-lambda/manual-layer/">AWS Lambda Layer</PlatformLink>.
While this is a quick way to add Sentry to your AWS Lambda function, it gives you limited configuration possibilities with environment vars. See <PlatformLink to="/integrations/aws-lambda/manual-layer/">AWS Lambda Layer</PlatformLink>.

## Install

Expand All @@ -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.

<OnboardingOptionButtons
options={[
'error-monitoring',
'performance',
'profiling',
]}
options={["error-monitoring", "performance", "profiling"]}
/>

```python
Expand Down Expand Up @@ -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 <PlatformLink to="/configuration/filtering/">modify the transaction sample rate</PlatformLink> using `traces_sample_rate`.
- Automatically include the following event reports:

- A link to CloudWatch Logs
- Function details
- `sys.argv` for the function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Include name="python-stream-mode-general-callout.mdx" />

You can also configure this function in one of the two ways described below:

- **Without touching your code:**
Expand Down Expand Up @@ -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.

Expand Down
7 changes: 5 additions & 2 deletions docs/platforms/python/integrations/bottle/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ 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.

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand Down Expand Up @@ -59,6 +62,8 @@ It takes a couple of moments for the data to appear in [sentry.io](https://sentr

## Options

<Include name="python-stream-mode-integration-option-callout.mdx" />

If you add `BottleIntegration` explicitly to your `sentry_sdk.init()` call you can set options for `BottleIntegration` to change its behavior:

```python
Expand Down Expand Up @@ -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/<foo>"`, 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.
Expand All @@ -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+
Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/python/integrations/celery/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ description: "Learn about using Sentry with Celery."

The Celery integration adds support for the [Celery Task Queue System](https://docs.celeryq.dev/).

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand Down Expand Up @@ -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__":
Expand Down Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ 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.

<Include name="python-stream-mode-general-callout.mdx" />

## Install

Install `sentry-sdk` from PyPI:

```bash {tabTitle:pip}
pip install sentry-sdk
```

```bash {tabTitle:uv}
uv add sentry-sdk
```
Expand All @@ -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")
Expand Down
Loading
Loading