Skip to content

Commit 325c8ed

Browse files
committed
fix(issues): Adding exception capture on Postgres timeout to keep them visible internally
A small addition on top of #87691. There we changed it so these errors are now treated as user errors but actually these could possibly come from our own Postgres queries taking too long even on reasonable queries, and without capturing we wouldn't even know they are happening. Even if thats not the case we want to keep these errors visible in Sentry to be able to monitor them.
1 parent ad84341 commit 325c8ed

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sentry/api/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ def handle_query_errors() -> Generator[None]:
429429
if hasattr(error, "pgcode") and error.pgcode == psycopg2.errorcodes.QUERY_CANCELED:
430430
if options.get("api.postgres-query-timeout-error-handling.enabled"):
431431
sentry_sdk.set_tag("query.error_reason", "Postgres statement timeout")
432+
sentry_sdk.capture_exception(
433+
error,
434+
level="warning",
435+
)
432436
raise Throttled(
433437
detail="Query timeout. Please try with a smaller date range or fewer conditions."
434438
)

0 commit comments

Comments
 (0)