Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Tracer.__init__() shouldn't share the default ScopeManager.
Browse files Browse the repository at this point in the history
We want to be on the safe side: now by default we let
scope_manager=None, and upon checking it within __init__(),
create a new ScopeManager if needed, so instances of Tracer don't share it.
  • Loading branch information
carlosalberto committed Feb 6, 2018
1 parent 544c7c9 commit 9991463
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opentracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ class Tracer(object):

_supported_formats = [Format.TEXT_MAP, Format.BINARY, Format.HTTP_HEADERS]

def __init__(self, scope_manager=ScopeManager()):
self._scope_manager = scope_manager
def __init__(self, scope_manager=None):
self._scope_manager = ScopeManager() if scope_manager is None \
else scope_manager
self._noop_span_context = SpanContext()
self._noop_span = Span(tracer=self, context=self._noop_span_context)
self._noop_scope = Scope(self._scope_manager, self._noop_span)
Expand Down

0 comments on commit 9991463

Please sign in to comment.