1111 capture_message ,
1212 start_span ,
1313 start_transaction ,
14+ continue_trace ,
1415)
1516from sentry_sdk .consts import SPANSTATUS
1617from sentry_sdk .transport import Transport
17- from sentry_sdk .tracing import Transaction
1818
1919
2020@pytest .mark .parametrize ("sample_rate" , [0.0 , 1.0 ])
@@ -57,9 +57,7 @@ def test_basic(sentry_init, capture_events, sample_rate):
5757
5858@pytest .mark .parametrize ("parent_sampled" , [True , False , None ])
5959@pytest .mark .parametrize ("sample_rate" , [0.0 , 1.0 ])
60- def test_continue_from_headers (
61- sentry_init , capture_envelopes , parent_sampled , sample_rate
62- ):
60+ def test_continue_trace (sentry_init , capture_envelopes , parent_sampled , sample_rate ):
6361 """
6462 Ensure data is actually passed along via headers, and that they are read
6563 correctly.
@@ -79,11 +77,12 @@ def test_continue_from_headers(
7977 "sentry-trace_id=771a43a4192642f0b136d5159a501700, "
8078 "sentry-public_key=49d0f7386ad645858ae85020e393bef3, "
8179 "sentry-sample_rate=0.01337, sentry-user_id=Amelie, "
80+ "sentry-sample_rand=0.250000, "
8281 "other-vendor-value-2=foo;bar;"
8382 )
8483
8584 # child transaction, to prove that we can read 'sentry-trace' header data correctly
86- child_transaction = Transaction . continue_from_headers (headers , name = "WRONG" )
85+ child_transaction = continue_trace (headers , name = "WRONG" )
8786 assert child_transaction is not None
8887 assert child_transaction .parent_sampled == parent_sampled
8988 assert child_transaction .trace_id == old_span .trace_id
@@ -98,6 +97,7 @@ def test_continue_from_headers(
9897 "public_key" : "49d0f7386ad645858ae85020e393bef3" ,
9998 "trace_id" : "771a43a4192642f0b136d5159a501700" ,
10099 "user_id" : "Amelie" ,
100+ "sample_rand" : "0.250000" ,
101101 "sample_rate" : "0.01337" ,
102102 }
103103
@@ -143,6 +143,7 @@ def test_continue_from_headers(
143143 "public_key" : "49d0f7386ad645858ae85020e393bef3" ,
144144 "trace_id" : "771a43a4192642f0b136d5159a501700" ,
145145 "user_id" : "Amelie" ,
146+ "sample_rand" : "0.250000" ,
146147 "sample_rate" : expected_sample_rate ,
147148 }
148149
@@ -172,14 +173,10 @@ def test_dynamic_sampling_head_sdk_creates_dsc(
172173
173174 # make sure transaction is sampled for both cases
174175 with mock .patch ("sentry_sdk.tracing_utils.Random.randrange" , return_value = 250000 ):
175- transaction = Transaction . continue_from_headers ({}, name = "Head SDK tx" )
176+ transaction = continue_trace ({}, name = "Head SDK tx" )
176177
177- # will create empty mutable baggage
178178 baggage = transaction ._baggage
179- assert baggage
180- assert baggage .mutable
181- assert baggage .sentry_items == {}
182- assert baggage .third_party_items == ""
179+ assert baggage is None
183180
184181 with start_transaction (transaction ):
185182 with start_span (op = "foo" , name = "foodesc" ):
@@ -291,7 +288,7 @@ def capture_event(self, event):
291288def test_trace_propagation_meta_head_sdk (sentry_init ):
292289 sentry_init (traces_sample_rate = 1.0 , release = "foo" )
293290
294- transaction = Transaction . continue_from_headers ({}, name = "Head SDK tx" )
291+ transaction = continue_trace ({}, name = "Head SDK tx" )
295292 meta = None
296293 span = None
297294
0 commit comments