Skip to content

Commit 49c5c2f

Browse files
author
alrex
authored
fix issue in opentracing shim causing span to be wrapped unnecessarily (#1776)
1 parent 77c9867 commit 49c5c2f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929
([#1726](https://github.com/open-telemetry/opentelemetry-python/pull/1726))
3030
- Added `__contains__` to `opentelementry.trace.span.TraceState`.
3131
([#1773](https://github.com/open-telemetry/opentelemetry-python/pull/1773))
32-
32+
- `opentelemetry-opentracing-shim` Fix an issue in the shim where a Span was being wrapped
33+
in a NonRecordingSpan when it wasn't necessary.
34+
([#1776](https://github.com/open-telemetry/opentelemetry-python/pull/1776))
3335

3436
## [1.0.0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.0.0) - 2021-03-26
3537
### Added

shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,11 @@ def inject(self, span_context, format: object, carrier: object):
681681

682682
propagator = get_global_textmap()
683683

684-
ctx = set_span_in_context(NonRecordingSpan(span_context.unwrap()))
684+
span = span_context.unwrap() if span_context else None
685+
if isinstance(span, OtelSpanContext):
686+
span = NonRecordingSpan(span)
687+
688+
ctx = set_span_in_context(span)
685689
propagator.inject(carrier, context=ctx)
686690

687691
def extract(self, format: object, carrier: object):

0 commit comments

Comments
 (0)