Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use traceflags object #472

Merged
merged 5 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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