Skip to content

Commit d113079

Browse files
committed
Use traceflags object
Fixes #471
1 parent f2311dd commit d113079

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def extract(
8585
trace_id=int(traceid, 16),
8686
span_id=int(spanid, 16),
8787
is_remote=True,
88-
trace_flags=traceflags,
88+
trace_flags=TraceFlags(traceflags),
8989
)
9090
),
9191
context,

Diff for: propagator/opentelemetry-propagator-ot-trace/tests/test_ot_trace_propagator.py

+8
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ def test_extract_trace_id_span_id_sampled_true(self):
248248
self.assertEqual(hex(span_context.span_id)[2:], "e457b5a2e4d86bd1")
249249
self.assertTrue(span_context.is_remote)
250250
self.assertEqual(span_context.trace_flags, TraceFlags.SAMPLED)
251+
self.assertIsInstance(
252+
get_current_span().get_span_context().trace_flags,
253+
TraceFlags
254+
)
251255

252256
def test_extract_trace_id_span_id_sampled_false(self):
253257
"""Test valid trace_id, span_id and sampled false"""
@@ -268,6 +272,10 @@ def test_extract_trace_id_span_id_sampled_false(self):
268272
self.assertEqual(hex(span_context.span_id)[2:], "e457b5a2e4d86bd1")
269273
self.assertTrue(span_context.is_remote)
270274
self.assertEqual(span_context.trace_flags, TraceFlags.DEFAULT)
275+
self.assertIsInstance(
276+
get_current_span().get_span_context().trace_flags,
277+
TraceFlags
278+
)
271279

272280
def test_extract_malformed_trace_id(self):
273281
"""Test extraction with malformed trace_id"""

0 commit comments

Comments
 (0)