dd-trace-py
dd-trace-py copied to clipboard
Remove side-effect on `ddtrace` import
Current situation
ddtrace.tracer is automatically created on ddtrace import. As a side-effect the AgentWriter instance is automatically created which might result in spawning new thread.
Requirements
- Allow integrations (mostly CI Visibility) to control tracer configuration on startup.
- Keep backwards compatibility for accessing
ddtrace.tracer.
Proposed changes
- Configuration changes might come as a result of #3703.
- Add
__getattr__method toddtrace/__init__.pythat will returnTracer()instance whentracerproperty is accessed.- Question: Do we want to keep the "global" tracer with import side effect as the "official" API in other module and if yes, where (
ddtrace.init:tracerorddtrace.global:traceror other)?
- Question: Do we want to keep the "global" tracer with import side effect as the "official" API in other module and if yes, where (