Skip to content

Commit

Permalink
Use traceflags object
Browse files Browse the repository at this point in the history
Fixes #471
  • Loading branch information
ocelotl committed Apr 27, 2021
1 parent f2311dd commit d113079
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def extract(
trace_id=int(traceid, 16),
span_id=int(spanid, 16),
is_remote=True,
trace_flags=traceflags,
trace_flags=TraceFlags(traceflags),
)
),
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ def test_extract_trace_id_span_id_sampled_true(self):
self.assertEqual(hex(span_context.span_id)[2:], "e457b5a2e4d86bd1")
self.assertTrue(span_context.is_remote)
self.assertEqual(span_context.trace_flags, TraceFlags.SAMPLED)
self.assertIsInstance(
get_current_span().get_span_context().trace_flags,
TraceFlags
)

def test_extract_trace_id_span_id_sampled_false(self):
"""Test valid trace_id, span_id and sampled false"""
Expand All @@ -268,6 +272,10 @@ def test_extract_trace_id_span_id_sampled_false(self):
self.assertEqual(hex(span_context.span_id)[2:], "e457b5a2e4d86bd1")
self.assertTrue(span_context.is_remote)
self.assertEqual(span_context.trace_flags, TraceFlags.DEFAULT)
self.assertIsInstance(
get_current_span().get_span_context().trace_flags,
TraceFlags
)

def test_extract_malformed_trace_id(self):
"""Test extraction with malformed trace_id"""
Expand Down

0 comments on commit d113079

Please sign in to comment.