Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 45ec5cf

Browse files
authored
Capture SoftTimeLimitExceeded errors (#1099)
1 parent 4229dee commit 45ec5cf

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

helpers/sentry.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22

33
import sentry_sdk
4-
from celery.exceptions import SoftTimeLimitExceeded
54
from sentry_sdk.integrations.celery import CeleryIntegration
65
from sentry_sdk.integrations.django import DjangoIntegration
76
from sentry_sdk.integrations.httpx import HttpxIntegration
@@ -12,14 +11,6 @@
1211
from helpers.version import get_current_version
1312

1413

15-
def before_send(event, hint):
16-
if "exc_info" in hint:
17-
exc_type, exc_value, tb = hint["exc_info"]
18-
if isinstance(exc_value, SoftTimeLimitExceeded):
19-
return None
20-
return event
21-
22-
2314
def is_sentry_enabled() -> bool:
2415
return bool(get_config("services", "sentry", "server_dsn"))
2516

@@ -30,7 +21,6 @@ def initialize_sentry() -> None:
3021
sentry_dsn = get_config("services", "sentry", "server_dsn")
3122
sentry_sdk.init(
3223
sentry_dsn,
33-
before_send=before_send,
3424
sample_rate=float(os.getenv("SENTRY_PERCENTAGE", 1.0)),
3525
environment=os.getenv("DD_ENV", "production"),
3626
traces_sample_rate=float(os.environ.get("SERVICES__SENTRY__SAMPLE_RATE", 1)),

helpers/tests/unit/test_sentry.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from helpers.sentry import before_send, initialize_sentry
3+
from helpers.sentry import initialize_sentry
44

55

66
class TestSentry(object):
@@ -16,7 +16,6 @@ def test_initialize_sentry(self, mocker, mock_configuration):
1616
assert initialize_sentry() is None
1717
mocked_init.assert_called_with(
1818
"this_dsn",
19-
before_send=before_send,
2019
release="worker-FAKE_VERSION_FOR_YOU",
2120
sample_rate=1.0,
2221
traces_sample_rate=1.0,

tasks/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def on_success(self, retval, task_id, args, kwargs):
363363

364364
def on_failure(self, exc, task_id, args, kwargs, einfo):
365365
"""
366-
Includes SoftTimeoutLimitException, for example
366+
Includes SoftTimeLimitExceeded, for example
367367
"""
368368
res = super().on_failure(exc, task_id, args, kwargs, einfo)
369369
self.task_failure_counter.inc()

0 commit comments

Comments
 (0)