@@ -126,7 +126,7 @@ def dummy_task(x, y):
126126 foo = 42 # noqa
127127 return x / y
128128
129- with start_transaction (op = "unit test transaction" ) as transaction :
129+ with sentry_sdk . start_span (op = "unit test transaction" ) as transaction :
130130 celery_invocation (dummy_task , 1 , 2 )
131131 _ , expected_context = celery_invocation (dummy_task , 1 , 0 )
132132
@@ -195,7 +195,7 @@ def dummy_task(x, y):
195195
196196 events = capture_events ()
197197
198- with start_transaction (name = "submission" ) as transaction :
198+ with sentry_sdk . start_span (name = "submission" ) as transaction :
199199 celery_invocation (dummy_task , 1 , 0 if task_fails else 1 )
200200
201201 if task_fails :
@@ -275,7 +275,7 @@ def test_simple_no_propagation(capture_events, init_celery):
275275 def dummy_task ():
276276 1 / 0
277277
278- with start_transaction () as transaction :
278+ with sentry_sdk . start_span () as transaction :
279279 dummy_task .delay ()
280280
281281 (event ,) = events
@@ -350,7 +350,7 @@ def dummy_task(self):
350350 runs .append (1 )
351351 1 / 0
352352
353- with start_transaction (name = "submit_celery" ):
353+ with sentry_sdk . start_span (name = "submit_celery" ):
354354 # Curious: Cannot use delay() here or py2.7-celery-4.2 crashes
355355 res = dummy_task .apply_async ()
356356
@@ -468,7 +468,7 @@ def __call__(self, *args, **kwargs):
468468 def dummy_task (x , y ):
469469 return x / y
470470
471- with start_transaction ():
471+ with sentry_sdk . start_span ():
472472 celery_invocation (dummy_task , 1 , 0 )
473473
474474 assert not events
@@ -509,7 +509,7 @@ def test_baggage_propagation(init_celery):
509509 def dummy_task (self , x , y ):
510510 return _get_headers (self )
511511
512- with start_transaction () as transaction :
512+ with sentry_sdk . start_span () as transaction :
513513 result = dummy_task .apply_async (
514514 args = (1 , 0 ),
515515 headers = {"baggage" : "custom=value" },
@@ -541,7 +541,7 @@ def dummy_task(self, message):
541541 trace_id = get_current_span ().trace_id
542542 return trace_id
543543
544- with start_transaction () as transaction :
544+ with sentry_sdk . start_span () as transaction :
545545 transaction_trace_id = transaction .trace_id
546546
547547 # should propagate trace
@@ -709,7 +709,7 @@ def publish(*args, **kwargs):
709709 @celery .task ()
710710 def task (): ...
711711
712- with start_transaction ():
712+ with sentry_sdk . start_span ():
713713 task .apply_async ()
714714
715715 (event ,) = events
@@ -772,7 +772,7 @@ def publish(*args, **kwargs):
772772 @celery .task ()
773773 def task (): ...
774774
775- with start_transaction (name = "custom_transaction" ):
775+ with sentry_sdk . start_span (name = "custom_transaction" ):
776776 task .apply_async ()
777777
778778 (event ,) = events
0 commit comments