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

refactor(tracer): remove @property for Tracer.context_provider #1371

Merged
merged 1 commit into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions ddtrace/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,7 @@ async def web_handler(request):
This method makes use of a ``ContextProvider`` that is automatically set during the tracer
initialization, or while using a library instrumentation.
"""
return self._context_provider.active(*args, **kwargs)

@property
def context_provider(self):
"""Returns the current Tracer Context Provider"""
return self._context_provider
return self.context_provider.active(*args, **kwargs)

# TODO: deprecate this method and make sure users create a new tracer if they need different parameters
@debtcollector.removals.removed_kwarg("dogstatsd_host", "Use `dogstatsd_url` instead",
Expand Down Expand Up @@ -290,7 +285,7 @@ def configure(
self.writer.dogstatsd = self._dogstatsd_client

if context_provider is not None:
self._context_provider = context_provider
self.context_provider = context_provider

if wrap_executor is not None:
self._wrap_executor = wrap_executor
Expand Down
2 changes: 1 addition & 1 deletion tests/contrib/asyncio/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_propagation_with_new_context(self):
def test_event_loop_unpatch(self):
# ensures that the event loop can be unpatched
unpatch()
assert isinstance(self.tracer._context_provider, DefaultContextProvider)
assert isinstance(self.tracer.context_provider, DefaultContextProvider)
assert asyncio.BaseEventLoop.create_task == _orig_create_task

def test_event_loop_double_patch(self):
Expand Down