Skip to content

Commit a42d7f5

Browse files
committed
Do not override already set error status with an ok status.
1 parent f264ad8 commit a42d7f5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sentry_sdk/integrations/huey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def _sentry_execute(self, task, timestamp=None):
162162

163163
sentry_headers = task.kwargs.pop("sentry_headers", {})
164164
with sentry_sdk.continue_trace(sentry_headers):
165-
with sentry_sdk.start_transaction(
165+
with sentry_sdk.start_span(
166166
name=task.name,
167167
op=OP.QUEUE_TASK_HUEY,
168168
source=TRANSACTION_SOURCE_TASK,

sentry_sdk/tracing.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,12 @@ def __exit__(self, ty, value, tb):
13131313
if value is not None:
13141314
self.set_status(SPANSTATUS.INTERNAL_ERROR)
13151315
else:
1316-
self.set_status(SPANSTATUS.OK)
1316+
status_already_set = (
1317+
not hasattr(self._otel_span, "status")
1318+
or self._otel_span.status.status_code != StatusCode.UNSET
1319+
)
1320+
if not status_already_set:
1321+
self.set_status(SPANSTATUS.OK)
13171322

13181323
self.finish()
13191324
context.detach(self._ctx_token)

0 commit comments

Comments
 (0)