@@ -1246,9 +1246,8 @@ def start_streamed_span(
12461246
12471247 if is_ignored_span (name , attributes ):
12481248 return NoOpStreamedSpan (
1249- trace_id = propagation_context .trace_id ,
1250- unsampled_reason = "ignored" ,
12511249 scope = self ,
1250+ unsampled_reason = "ignored" ,
12521251 )
12531252
12541253 sampled , sample_rate , sample_rand , outcome = make_sampling_decision (
@@ -1258,9 +1257,8 @@ def start_streamed_span(
12581257 )
12591258 if sampled is False :
12601259 return NoOpStreamedSpan (
1261- trace_id = propagation_context .trace_id ,
1262- unsampled_reason = outcome ,
12631260 scope = self ,
1261+ unsampled_reason = outcome ,
12641262 )
12651263
12661264 if sample_rate is not None :
@@ -1282,11 +1280,13 @@ def start_streamed_span(
12821280
12831281 # This is a child span; take propagation context from the parent span
12841282 with new_scope ():
1285- if is_ignored_span (name , attributes ) or isinstance (
1286- parent_span , NoOpStreamedSpan
1287- ):
1283+ if is_ignored_span (name , attributes ):
1284+ return NoOpStreamedSpan (
1285+ unsampled_reason = "ignored" ,
1286+ )
1287+ if isinstance (parent_span , NoOpStreamedSpan ):
12881288 return NoOpStreamedSpan (
1289- trace_id = parent_span .trace_id , unsampled_reason = "ignored"
1289+ unsampled_reason = parent_span ._unsampled_reason ,
12901290 )
12911291
12921292 return StreamedSpan (
@@ -1302,7 +1302,7 @@ def start_streamed_span(
13021302
13031303 def _update_sample_rate (self , sample_rate : float ) -> None :
13041304 # If we had to adjust the sample rate when setting the sampling decision
1305- # for the spans , it needs to be updated in the propagation context too
1305+ # for a span , it needs to be updated in the propagation context too
13061306 propagation_context = self .get_active_propagation_context ()
13071307 baggage = propagation_context .baggage
13081308
0 commit comments