Skip to content

Commit f9b4a4a

Browse files
committed
Call patch_all before importing handler code.
1 parent 9b694f7 commit f9b4a4a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

datadog_lambda/wrapper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
extract_http_status_code_tag,
4646
)
4747

48+
# Patch third-party libraries for tracing, must be done before importing any
49+
# handler code.
50+
patch_all()
51+
4852
profiling_env_var = os.environ.get("DD_PROFILING_ENABLED", "false").lower() == "true"
4953
if profiling_env_var:
5054
from ddtrace.profiling import profiler
@@ -223,8 +227,6 @@ def __init__(self, func):
223227
os.environ[DD_REQUESTS_SERVICE_NAME] = os.environ.get(
224228
DD_SERVICE, "aws.lambda"
225229
)
226-
# Patch third-party libraries for tracing
227-
patch_all()
228230

229231
# Enable LLM Observability
230232
if llmobs_env_var:

0 commit comments

Comments
 (0)