Skip to content

Commit 5c80398

Browse files
committed
Call patch_all before importing handler code.
1 parent 7bc8751 commit 5c80398

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
@@ -47,6 +47,10 @@
4747
extract_http_status_code_tag,
4848
)
4949

50+
# Patch third-party libraries for tracing, must be done before importing any
51+
# handler code.
52+
patch_all()
53+
5054
if config.profiling_enabled:
5155
from ddtrace.profiling import profiler
5256

@@ -142,8 +146,6 @@ def __init__(self, func):
142146
os.environ[DD_REQUESTS_SERVICE_NAME] = os.environ.get(
143147
DD_SERVICE, "aws.lambda"
144148
)
145-
# Patch third-party libraries for tracing
146-
patch_all()
147149

148150
# Enable LLM Observability
149151
if config.llmobs_enabled:

0 commit comments

Comments
 (0)