|
11 | 11 | _patch_redbeat_maybe_due, |
12 | 12 | _setup_celery_beat_signals, |
13 | 13 | ) |
14 | | -from sentry_sdk.integrations.celery.utils import NoOpMgr, _now_seconds_since_epoch |
| 14 | +from sentry_sdk.integrations.celery.utils import _now_seconds_since_epoch |
15 | 15 | from sentry_sdk.integrations.logging import ignore_logger |
16 | 16 | from sentry_sdk.tracing import BAGGAGE_HEADER_NAME, TRANSACTION_SOURCE_TASK |
17 | 17 | from sentry_sdk._types import TYPE_CHECKING |
|
30 | 30 | from typing import List |
31 | 31 | from typing import Optional |
32 | 32 | from typing import TypeVar |
33 | | - from typing import Union |
34 | 33 |
|
35 | 34 | from sentry_sdk._types import EventProcessor, Event, Hint, ExcInfo |
36 | 35 | from sentry_sdk.tracing import Span |
@@ -243,15 +242,9 @@ def apply_async(*args, **kwargs): |
243 | 242 |
|
244 | 243 | task = args[0] |
245 | 244 |
|
246 | | - # Do not create a span when the task is a Celery Beat task |
247 | | - # (Because we do not have a transaction in that case) |
248 | | - span_mgr = ( |
249 | | - sentry_sdk.start_span(op=OP.QUEUE_SUBMIT_CELERY, description=task.name) |
250 | | - if not Scope.get_isolation_scope()._name == "celery-beat" |
251 | | - else NoOpMgr() |
252 | | - ) # type: Union[Span, NoOpMgr] |
253 | | - |
254 | | - with span_mgr as span: |
| 245 | + with sentry_sdk.start_span( |
| 246 | + op=OP.QUEUE_SUBMIT_CELERY, description=task.name |
| 247 | + ) as span: |
255 | 248 | kwargs["headers"] = _update_celery_task_headers( |
256 | 249 | kwarg_headers, span, integration.monitor_beat_tasks |
257 | 250 | ) |
|
0 commit comments