Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Dec 23, 2024
1 parent 2120e18 commit ae5f130
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
10 changes: 7 additions & 3 deletions sentry_sdk/integrations/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,13 @@ def _inner(*args, **kwargs):
# for some reason, args[1] is a list if non-empty but a
# tuple if empty
attributes=_prepopulate_attributes(task, list(args[1]), args[2]),
) as transaction:
transaction.set_status(SPANSTATUS.OK)
return f(*args, **kwargs)
) as root_span:
return_value = f(*args, **kwargs)

if root_span.status is None:
root_span.set_status(SPANSTATUS.OK)

return return_value

return _inner # type: ignore

Expand Down
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def benchmark():
)


# Disabling this, because this leads in Potel to Celery tests failing
# TODO: Check if disabling this broke a bunch of other test (not sure how to do)
# @pytest.fixture(autouse=True)
@pytest.fixture(autouse=True)
def clean_scopes():
"""
Resets the scopes for every test to avoid leaking data between tests.
Expand Down
3 changes: 3 additions & 0 deletions tests/integrations/celery/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ def dummy_task(x, y):
"timestamp": submission_event["spans"][0]["timestamp"],
"trace_id": str(span.trace_id),
"status": "ok",
"tags": {
"status": "ok",
}
}
]

Expand Down

0 comments on commit ae5f130

Please sign in to comment.