Skip to content

Commit 20806cb

Browse files
committed
ref(sdk): filter asyncio.CancelledError events
1 parent 16bf78b commit 20806cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/sentry/hybridcloud/apigateway_async/proxy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import httpx
1313
from asgiref.sync import sync_to_async
1414
from django.conf import settings
15-
from django.core.exceptions import RequestAborted
1615
from django.http import HttpRequest, HttpResponse, JsonResponse, StreamingHttpResponse
1716
from django.http.response import HttpResponseBase
1817

@@ -199,7 +198,7 @@ async def proxy_cell_request(
199198
return _adapt_response(resp, target_url)
200199
except asyncio.CancelledError:
201200
metrics.incr("apigateway.proxy.request_aborted", tags=metric_tags)
202-
raise RequestAborted()
201+
raise
203202
except httpx.TimeoutException:
204203
metrics.incr("apigateway.proxy.request_timeout", tags=metric_tags)
205204
circuitbreaker.incr_failures()

src/sentry/utils/sdk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ def before_send(event: Event, hint: Hint) -> Event | None:
255255
if settings.SENTRY_LOCAL_CELL:
256256
event["tags"]["sentry_region"] = settings.SENTRY_LOCAL_CELL
257257

258-
if hint.get("exc_info", [None])[0] == OperationalError:
258+
event_exc: type[BaseException] | None = hint.get("exc_info", [None])[0]
259+
if event_exc == asyncio.CancelledError:
260+
return None
261+
if event_exc == OperationalError:
259262
event["level"] = "warning"
260263

261264
return event

0 commit comments

Comments
 (0)