File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,32 +90,19 @@ def _inner(*args, **kwargs):
9090 with hub .push_scope () as scope :
9191 scope ._name = "celery"
9292 scope .clear_breadcrumbs ()
93- span = _continue_trace ( args [ 3 ]. get ( "headers" ) or {}, scope )
93+ scope . add_event_processor ( _make_event_processor ( task , * args , ** kwargs ) )
9494
9595 with capture_internal_exceptions ():
96+ # Celery task objects are not a thing to be trusted. Even
97+ # something such as attribute access can fail.
9698 scope .transaction = task .name
9799
98- scope .add_event_processor (_make_event_processor (task , * args , ** kwargs ))
99-
100- try :
100+ with hub .trace (Span .continue_from_headers (args [3 ].get ("headers" ) or {})):
101101 return f (* args , ** kwargs )
102- finally :
103- span .finish ()
104- hub .finish_trace (span )
105102
106103 return _inner
107104
108105
109- def _continue_trace (headers , scope ):
110- if headers :
111- span = Span .continue_from_headers (headers )
112- else :
113- span = Span .start_trace ()
114-
115- scope .span = span
116- return span
117-
118-
119106def _wrap_task_call (task , f ):
120107 # Need to wrap task call because the exception is caught before we get to
121108 # see it. Also celery's reported stacktrace is untrustworthy.
You can’t perform that action at this time.
0 commit comments