Skip to content

Commit ac4f7ba

Browse files
fix tests
1 parent 0f1d9b0 commit ac4f7ba

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

sentry_sdk/integrations/arq.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,18 @@ def _wrap_coroutine(name: str, coroutine: "WorkerCoroutine") -> "WorkerCoroutine
191191
async def _sentry_coroutine(
192192
ctx: "Dict[Any, Any]", *args: "Any", **kwargs: "Any"
193193
) -> "Any":
194-
integration = sentry_sdk.get_client().get_integration(ArqIntegration)
194+
client = sentry_sdk.get_client()
195+
integration = client.get_integration(ArqIntegration)
195196
if integration is None:
196197
return await coroutine(ctx, *args, **kwargs)
197198

198-
span = sentry_sdk.traces.get_current_span()
199-
if span is not None:
200-
span.name = name
199+
if has_span_streaming_enabled(client.options):
200+
span = sentry_sdk.traces.get_current_span()
201+
if span is not None:
202+
span.name = name
203+
204+
scope = sentry_sdk.get_current_scope()
205+
scope.set_transaction_name(name)
201206

202207
sentry_sdk.get_isolation_scope().add_event_processor(
203208
_make_event_processor({**ctx, "job_name": name}, *args, **kwargs)

0 commit comments

Comments
 (0)