Skip to content

Commit

Permalink
Use traceflags object (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Apr 27, 2021
1 parent 45c94e7 commit bdbc249
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python-contrib/compare/v0.200...HEAD)

### Changed
- `opentelemetry-propagator-ot-trace` Use `TraceFlags` object in `extract`
([#472](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/472))

### Added
- Move `opentelemetry-instrumentation` from core repository
([#465](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/465))
Expand Down
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,9 @@ 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 +271,9 @@ 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 bdbc249

Please sign in to comment.