getsentry / getsentry/sentry-python

Sentry spamming RequestAborted on async django 5

未关闭
#4,380 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Better Async Support Improvement Python
主要语言
Python
星标
2.2k
派生
669
平均合并
1 天 1 小时
30 天内合并 PR
213

描述

### How do you use Sentry?

Sentry Saas (sentry.io)

### Version

sentry-sdk==2.6.0
django==5.0.6
### Steps to Reproduce

1. django app on completely async stack;
2. sentry configuration:
```
sentry_sdk.init(
dsn=SENTRY_DSN,
traces_sample_rate=1.0 if ENV == Envs.Prod.value else 0.1,
profiles_sample_rate=1.0,
environment=ENV.value,
send_default_pii=True,
integrations=[
DjangoIntegration(
transaction_style="url",
middleware_spans=True,
signals_spans=False,
cache_spans=False,
),
AsyncioIntegration(),
],
)
```
3. run app with uvicorn via asgi: `python -m uvicorn myproject.asgi:application`
4. openning any view, accessing any admin url - sends `RequestAborted` error to sentry UI:
```
RequestAborted: null
File "django/core/handlers/asgi.py", line 245, in listen_for_disconnect
raise RequestAborted()
```
----

As we look into django code: https://github.com/django/django/blob/bcd255cd5ca0a1e686d276cca71f45ec400d84a2/django/core/handlers/asgi.py#L195-L202, raising this exception is expected for every http request, and is handled by django https://github.com/django/django/blob/bcd255cd5ca0a1e686d276cca71f45ec400d84a2/django/core/handlers/asgi.py#L209-L211 so we do not need to send errors on that.

Do you plan to fix this issue?

### Expected Result

no error sent to sentry

### Actual Result

Screenshot 2024-06-26 at 17 03 09
Screenshot 2024-06-26 at 17 03 36

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。