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

ModuleWatchdog is installed unconditionally when ddtrace is imported #9143

Open
millerdev opened this issue May 1, 2024 · 1 comment
Open

Comments

@millerdev
Copy link

Summary of problem

ModuleWatchdog is installed unconditionally on import.

ModuleWatchdog.install()

This clutters stack traces with many extra lines and generally makes debugging unrelated things more difficult. It would be nice to have a way to disable that with the environment variable DD_TRACE_ENABLED=false.

It would also be nice if DD_TRACE_ENABLED was a master kill switch for all things that get installed automatically on import. For example, currently it looks like DD_INSTRUMENTATION_TELEMETRY_ENABLED is a separate switch that does not respect DD_TRACE_ENABLED=false.

How can we reproduce your problem?

  • Set environment variable DD_TRACE_ENABLED=false
  • Import ddtrace in a Python shell (see below)
  • ModuleWatchdog and other things (instrumentation telemetry, etc.) should not be installed automatically on import. ModuleWatchdog installation can be checked by looking at the type of sys.modules:
$ export DD_TRACE_ENABLED=false
$ python
>>> import sys
>>> type(sys.modules)
<class 'dict'>
>>> import ddtrace
>>> type(sys.modules)
<class 'ddtrace.internal.module.ModuleWatchdog'>
# expected <class 'dict'>
@emmettbutler
Copy link
Collaborator

Thanks for this, @millerdev. Sounds like a useful bit of functionality to add. We'll add this to our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants