dd-trace-py
dd-trace-py copied to clipboard
Disabling intrument_middleware via code not working in Django
Which version of dd-trace-py are you using?
1.1.2
Which version of pip are you using?
22.0.4
Which version of the libraries are you using?
/
How can we reproduce your problem?
Disable instrument_middleware via config code in Django integration does not work:
Example: (neither of these work):
ddtrace.config.django.instrument_middleware = False
ddtrace.config.django["instrument_middleware"] = False
Configuring this via env variable (DD_DJANGO_INSTRUMENT_MIDDLEWARE) works.
hey @Meemaw thank you for opening this issue.
it is probably misleading that this is configurable in code. this configuration needs to happen before we patch django.
this means it needs to happen before ddtrace.patch_all() is called. if you are using ddtrace-run, then you must you the env variable because you won't have an opportunity to set the configuration option before patching occurs.