Skip to content

Commit b9edbb2

Browse files
authored
Prevent early activations in Django instrumentation (#1534)
1 parent 7134a68 commit b9edbb2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

newrelic/hooks/framework_django.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import threading
1919
import warnings
2020

21-
from newrelic.api.application import application_settings, register_application
21+
from newrelic.api.application import register_application
2222
from newrelic.api.background_task import BackgroundTaskWrapper
2323
from newrelic.api.error_trace import wrap_error_trace
2424
from newrelic.api.function_trace import FunctionTrace, FunctionTraceWrapper, wrap_function_trace
@@ -1094,7 +1094,8 @@ def _wrapper(wrapped, instance, args, kwargs):
10941094
# avoid this logic for multiple calls to the same middleware?
10951095
# Also, is that even a scenario we need to worry about?
10961096
def is_denied_middleware(callable_name):
1097-
settings = application_settings() or global_settings()
1097+
# Do not call application_settings() here, as it will cause an early activation.
1098+
settings = global_settings()
10981099

10991100
# Return True (skip wrapping) if:
11001101
# 1. middleware wrapping is disabled or

0 commit comments

Comments
 (0)