diff --git a/CHANGELOG.md b/CHANGELOG.md index 655762a5611..34100fc4a1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- **Docs**: Clarify confusion on Tracer reuse and `auto_patch=False` statement + ## [1.1.1] - 2020-08-14 ### Fixed - **Logger**: Regression on `Logger` level not accepting `int` i.e. `Logger(level=logging.INFO)` diff --git a/docs/content/core/tracer.mdx b/docs/content/core/tracer.mdx index ba489b0c965..17b1b540f0b 100644 --- a/docs/content/core/tracer.mdx +++ b/docs/content/core/tracer.mdx @@ -199,6 +199,11 @@ async def collect_payment(charge_id): 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. + + When reusing Tracer in Lambda Layers, or in multiple modules, do not set auto_patch=False, because import order matters. +

This can result in the first Tracer config being inherited by new instances, and their modules not being patched. +

+ ```python:title=lambda_handler.py # handler.py from aws_lambda_powertools import Tracer @@ -214,8 +219,8 @@ def handler(event, context): ```python:title=another_file.py from aws_lambda_powertools import Tracer # highlight-start -# new instance using existing configuration with auto patching overriden -tracer = Tracer(auto_patch=False) +# new instance using existing configuration +tracer = Tracer(service="payment") # highlight-end ```