Skip to content

Commit ec7e2d7

Browse files
committed
set celery task name
1 parent 021f3f7 commit ec7e2d7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sentry_sdk/integrations/celery/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,7 @@ def _inner(*args: "Any", **kwargs: "Any") -> "Any":
329329
headers = args[3].get("headers") or {}
330330
if span_streaming:
331331
sentry_sdk.traces.continue_trace(headers)
332-
transaction = sentry_sdk.traces.start_span(
333-
name="unknown celery task"
334-
)
332+
transaction = sentry_sdk.traces.start_span(name=task.name)
335333
transaction.set_origin(CeleryIntegration.origin)
336334
transaction.set_source(TransactionSource.TASK)
337335
transaction.set_op(OP.QUEUE_TASK_CELERY)
@@ -342,11 +340,10 @@ def _inner(*args: "Any", **kwargs: "Any") -> "Any":
342340
transaction = continue_trace(
343341
headers,
344342
op=OP.QUEUE_TASK_CELERY,
345-
name="unknown celery task",
343+
name=task.name,
346344
source=TransactionSource.TASK,
347345
origin=CeleryIntegration.origin,
348346
)
349-
transaction.name = task.name
350347
transaction.set_status(SPANSTATUS.OK)
351348

352349
span_ctx = sentry_sdk.start_transaction(

0 commit comments

Comments
 (0)