@@ -126,14 +126,14 @@ def dummy_task(x, y):
126126 foo = 42 # noqa
127127 return x / y
128128
129- with sentry_sdk .start_span (op = "unit test transaction" ) as transaction :
129+ with sentry_sdk .start_span (op = "unit test transaction" ) as span :
130130 celery_invocation (dummy_task , 1 , 2 )
131131 _ , expected_context = celery_invocation (dummy_task , 1 , 0 )
132132
133133 (_ , error_event , _ , _ ) = events
134134
135- assert error_event ["contexts" ]["trace" ]["trace_id" ] == transaction .trace_id
136- assert error_event ["contexts" ]["trace" ]["span_id" ] != transaction .span_id
135+ assert error_event ["contexts" ]["trace" ]["trace_id" ] == span .trace_id
136+ assert error_event ["contexts" ]["trace" ]["span_id" ] != span .span_id
137137 assert error_event ["transaction" ] == "dummy_task"
138138 assert "celery_task_id" in error_event ["tags" ]
139139 assert error_event ["extra" ]["celery-job" ] == dict (
@@ -271,11 +271,11 @@ def test_simple_no_propagation(capture_events, init_celery):
271271 def dummy_task ():
272272 1 / 0
273273
274- with sentry_sdk .start_span () as transaction :
274+ with sentry_sdk .start_span () as span :
275275 dummy_task .delay ()
276276
277277 (event ,) = events
278- assert event ["contexts" ]["trace" ]["trace_id" ] != transaction .trace_id
278+ assert event ["contexts" ]["trace" ]["trace_id" ] != span .trace_id
279279 assert event ["transaction" ] == "dummy_task"
280280 (exception ,) = event ["exception" ]["values" ]
281281 assert exception ["type" ] == "ZeroDivisionError"
@@ -505,7 +505,7 @@ def test_baggage_propagation(init_celery):
505505 def dummy_task (self , x , y ):
506506 return _get_headers (self )
507507
508- with sentry_sdk .start_span () as transaction :
508+ with sentry_sdk .start_span () as span :
509509 result = dummy_task .apply_async (
510510 args = (1 , 0 ),
511511 headers = {"baggage" : "custom=value" },
@@ -514,7 +514,7 @@ def dummy_task(self, x, y):
514514 assert sorted (result ["baggage" ].split ("," )) == sorted (
515515 [
516516 "sentry-release=abcdef" ,
517- "sentry-trace_id={}" .format (transaction .trace_id ),
517+ "sentry-trace_id={}" .format (span .trace_id ),
518518 "sentry-environment=production" ,
519519 "sentry-sample_rate=1.0" ,
520520 "sentry-sampled=true" ,
@@ -537,8 +537,8 @@ def dummy_task(self, message):
537537 trace_id = get_current_span ().trace_id
538538 return trace_id
539539
540- with sentry_sdk .start_span () as transaction :
541- transaction_trace_id = transaction .trace_id
540+ with sentry_sdk .start_span () as span :
541+ transaction_trace_id = span .trace_id
542542
543543 # should propagate trace
544544 task_transaction_id = dummy_task .apply_async (
0 commit comments