File tree 2 files changed +6
-0
lines changed
src/opentelemetry/sdk/trace
2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -509,6 +509,8 @@ def start_span( # pylint: disable=too-many-locals
509
509
)
510
510
511
511
if sampling_decision .sampled :
512
+ options = context .trace_options | trace_api .TraceOptions .SAMPLED
513
+ context .trace_options = trace_api .TraceOptions (options )
512
514
if attributes is None :
513
515
span_attributes = sampling_decision .attributes
514
516
else :
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ def test_default_sampler(self):
117
117
self .assertIsInstance (root_span , trace .Span )
118
118
child_span = tracer .start_span (name = "child span" , parent = root_span )
119
119
self .assertIsInstance (child_span , trace .Span )
120
+ self .assertTrue (root_span .context .trace_options .sampled )
120
121
121
122
def test_sampler_no_sampling (self ):
122
123
tracer_source = trace .TracerSource (sampling .ALWAYS_OFF )
@@ -251,6 +252,9 @@ def test_start_span_explicit(self):
251
252
other_parent = trace_api .SpanContext (
252
253
trace_id = 0x000000000000000000000000DEADBEEF ,
253
254
span_id = 0x00000000DEADBEF0 ,
255
+ trace_options = trace_api .TraceOptions (
256
+ trace_api .TraceOptions .SAMPLED
257
+ ),
254
258
)
255
259
256
260
self .assertIsNone (tracer .get_current_span ())
You can’t perform that action at this time.
0 commit comments