Skip to content

Commit 106ded0

Browse files
committed
docs: clarify auto_patch as per #108
1 parent 24a3bdf commit 106ded0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/content/core/tracer.mdx

+7-2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ async def collect_payment(charge_id):
199199

200200
Tracer keeps a copy of its configuration after the first initialization. This is useful for scenarios where you want to use Tracer in more than one location across your code base.
201201

202+
<Note type="warning">
203+
When reusing Tracer in Lambda Layers, or in multiple modules, <strong>do not set <code>auto_patch=False</code></strong>, because import order matters.
204+
<br/><br/>This can result in the first Tracer config being inherited by new instances, and their modules not being patched.
205+
</Note><br/>
206+
202207
```python:title=lambda_handler.py
203208
# handler.py
204209
from aws_lambda_powertools import Tracer
@@ -214,8 +219,8 @@ def handler(event, context):
214219
```python:title=another_file.py
215220
from aws_lambda_powertools import Tracer
216221
# highlight-start
217-
# new instance using existing configuration with auto patching overriden
218-
tracer = Tracer(auto_patch=False)
222+
# new instance using existing configuration
223+
tracer = Tracer(service="payment")
219224
# highlight-end
220225
```
221226

0 commit comments

Comments
 (0)