dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

Disabling intrument_middleware via code not working in Django

Open Meemaw opened this issue 3 years ago • 1 comments

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.

Meemaw avatar Jun 13 '22 08:06 Meemaw

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.

brettlangdon avatar Jun 13 '22 14:06 brettlangdon