Skip to content

Commit f0b8eb6

Browse files
committed
Fix arq tests
1 parent 9d20ffd commit f0b8eb6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sentry_sdk/integrations/arq.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import sys
22

3+
from opentelemetry.trace.status import StatusCode
4+
35
import sentry_sdk
46
from sentry_sdk.consts import OP, SPANSTATUS
57
from sentry_sdk.integrations import DidNotEnable, Integration
@@ -116,7 +118,14 @@ async def _sentry_run_job(self, job_id, score):
116118
origin=ArqIntegration.origin,
117119
) as span:
118120
return_value = await old_run_job(self, job_id, score)
119-
span.set_status(SPANSTATUS.OK)
121+
122+
status_unset = (
123+
hasattr(span._otel_span, "status")
124+
and span._otel_span.status.status_code == StatusCode.UNSET
125+
)
126+
if status_unset:
127+
span.set_status(SPANSTATUS.OK)
128+
120129
return return_value
121130

122131
Worker.run_job = _sentry_run_job

0 commit comments

Comments
 (0)