Skip to content

Commit 4723dc2

Browse files
committed
feat: hardcode fingerprint for celery timeouts
1 parent f65bf45 commit 4723dc2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

sentry_sdk/integrations/celery.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import absolute_import
22

33
from celery.signals import task_failure, task_prerun, task_postrun
4+
from celery.exceptions import SoftTimeLimitExceeded
45

56
from sentry_sdk import get_current_hub, configure_scope, capture_exception
67
from sentry_sdk.hub import _internal_exceptions
@@ -23,7 +24,18 @@ def _process_failure_signal(self, sender, task_id, einfo, **kw):
2324
if hasattr(sender, "throws") and isinstance(einfo.exception, sender.throws):
2425
return
2526

26-
capture_exception(einfo.exc_info)
27+
if isinstance(einfo.exception, SoftTimeLimitExceeded):
28+
with get_current_hub().push_scope():
29+
with configure_scope() as scope:
30+
scope.fingerprint = [
31+
"celery",
32+
"SoftTimeLimitExceeded",
33+
getattr(sender, "name", sender),
34+
]
35+
36+
capture_exception(einfo.exc_info)
37+
else:
38+
capture_exception(einfo.exc_info)
2739

2840
def _handle_task_prerun(self, sender, task, **kw):
2941
with _internal_exceptions():

0 commit comments

Comments
 (0)