@@ -120,7 +120,7 @@ def test_span_sampled_when_created(sentry_init, capture_envelopes):
120120 # at start_span() time
121121
122122 def traces_sampler (sampling_context ):
123- assert "delayed_attribute" not in sampling_context ["attributes" ]
123+ assert "delayed_attribute" not in sampling_context ["span" ][ " attributes" ]
124124 return 1.0
125125
126126 sentry_init (
@@ -169,9 +169,9 @@ def test_start_span_attributes(sentry_init, capture_envelopes):
169169
170170def test_start_span_attributes_in_traces_sampler (sentry_init , capture_envelopes ):
171171 def traces_sampler (sampling_context ):
172- assert "attributes" in sampling_context
173- assert "my_attribute" in sampling_context ["attributes" ]
174- assert sampling_context ["attributes" ]["my_attribute" ] == "my_value"
172+ assert "attributes" in sampling_context [ "span" ]
173+ assert "my_attribute" in sampling_context ["span" ][ " attributes" ]
174+ assert sampling_context ["span" ][ " attributes" ]["my_attribute" ] == "my_value"
175175 return 1.0
176176
177177 sentry_init (
@@ -202,16 +202,16 @@ def test_sampling_context(sentry_init, capture_envelopes):
202202 def traces_sampler (sampling_context ):
203203 nonlocal received_trace_id
204204
205- assert "trace_id" in sampling_context
206- received_trace_id = sampling_context ["trace_id" ]
205+ assert "trace_id" in sampling_context [ "span" ]
206+ received_trace_id = sampling_context ["span" ][ " trace_id" ]
207207
208- assert "parent_span_id" in sampling_context
209- assert sampling_context ["parent_span_id" ] is None
208+ assert "parent_span_id" in sampling_context [ "span" ]
209+ assert sampling_context ["span" ][ " parent_span_id" ] is None
210210
211- assert "parent_sampled" in sampling_context
212- assert sampling_context ["parent_sampled" ] is None
211+ assert "parent_sampled" in sampling_context [ "span" ]
212+ assert sampling_context ["span" ][ " parent_sampled" ] is None
213213
214- assert "attributes" in sampling_context
214+ assert "attributes" in sampling_context [ "span" ]
215215
216216 return 1.0
217217
@@ -263,7 +263,7 @@ def traces_sampler(sampling_context):
263263
264264def test_custom_sampling_context_update_to_context_value_persists (sentry_init ):
265265 def traces_sampler (sampling_context ):
266- if sampling_context ["attributes" ]["first" ] is True :
266+ if sampling_context ["span" ][ " attributes" ]["first" ] is True :
267267 assert sampling_context ["custom_value" ] == 1
268268 else :
269269 assert sampling_context ["custom_value" ] == 2
@@ -361,10 +361,10 @@ class Class:
361361
362362def test_traces_sampler_drops_span (sentry_init , capture_envelopes ):
363363 def traces_sampler (sampling_context ):
364- assert "attributes" in sampling_context
365- assert "drop" in sampling_context ["attributes" ]
364+ assert "attributes" in sampling_context [ "span" ]
365+ assert "drop" in sampling_context ["span" ][ " attributes" ]
366366
367- if sampling_context ["attributes" ]["drop" ] is True :
367+ if sampling_context ["span" ][ " attributes" ]["drop" ] is True :
368368 return 0.0
369369
370370 return 1.0
@@ -398,7 +398,7 @@ def test_traces_sampler_called_once_per_segment(sentry_init):
398398 def traces_sampler (sampling_context ):
399399 nonlocal traces_sampler_called , span_name_in_traces_sampler
400400 traces_sampler_called += 1
401- span_name_in_traces_sampler = sampling_context ["name" ]
401+ span_name_in_traces_sampler = sampling_context ["span" ][ " name" ]
402402 return 1.0
403403
404404 sentry_init (
0 commit comments