Skip to content

Commit ae5f130

Browse files
committed
Some cleanup
1 parent 2120e18 commit ae5f130

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

sentry_sdk/integrations/celery/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,13 @@ def _inner(*args, **kwargs):
322322
# for some reason, args[1] is a list if non-empty but a
323323
# tuple if empty
324324
attributes=_prepopulate_attributes(task, list(args[1]), args[2]),
325-
) as transaction:
326-
transaction.set_status(SPANSTATUS.OK)
327-
return f(*args, **kwargs)
325+
) as root_span:
326+
return_value = f(*args, **kwargs)
327+
328+
if root_span.status is None:
329+
root_span.set_status(SPANSTATUS.OK)
330+
331+
return return_value
328332

329333
return _inner # type: ignore
330334

tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ def benchmark():
6868
)
6969

7070

71-
# Disabling this, because this leads in Potel to Celery tests failing
72-
# TODO: Check if disabling this broke a bunch of other test (not sure how to do)
73-
# @pytest.fixture(autouse=True)
71+
@pytest.fixture(autouse=True)
7472
def clean_scopes():
7573
"""
7674
Resets the scopes for every test to avoid leaking data between tests.

tests/integrations/celery/test_celery.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ def dummy_task(x, y):
237237
"timestamp": submission_event["spans"][0]["timestamp"],
238238
"trace_id": str(span.trace_id),
239239
"status": "ok",
240+
"tags": {
241+
"status": "ok",
242+
}
240243
}
241244
]
242245

0 commit comments

Comments
 (0)