You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reusing Tracer across your code disables patching boto3Β #108
Thatβs exactly it Michael - Could you try removing auto_patch from your
shared?
Under the hood, a module is only patched once by X-Ray SDK as it uses the
importlib package.
Iβll leave this open to add a clarification note in the docs about this
On Sat, 15 Aug 2020 at 05:02, Michael Brewer ***@***.***> wrote:
*What were you trying to accomplish?*
I am have my shared code include @tracer but i don't want to double patch
boto3 etc..
Expected Behavior
tracer = Tracer(auto_patch=False) should not disable patching in the main
lambda handler
Current Behavior
When i go into the console now of the boto3 activity appears
# main.pyfrom aws_lambda_powertools import Tracerfrom app import shared
tracer = Tracer(service="payment")
@tracer.capture_lambda_handlerdef handler(event, context):
pass
# shared.pyfrom aws_lambda_powertools import Tracer
tracer = Tracer(auto_patch=False)
Possible Solution
I think because the shared.py - tracer = Tracer(auto_patch=False) code is
called before the main.py. The patching has already been disabled.
Environment
- *Powertools version used*: 1.1.1
β
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#108>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBGD7VEEB7EREACBVJLSAX3CZANCNFSM4QABHJ4A>
.
Ok. Then I must have misunderstood the docs. I thought if you don't want to double patch you turn it off in the shared code but it will patch in the main handler file.
Currently I don't include it and it works. I guess it is a matter looking closely at the docs.
On Sat, 15 Aug 2020 at 06:54, Michael Brewer ***@***.***> wrote:
Ok. Then I must have misunderstood the docs. I thought if you don't want
to double patch you turn it off in the shared code but it will patch in the
main handler file.
Currently I don't include it and it works. I guess it is a matter looking
closely at the docs.
β
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBHCQW32UW4MCPZA47LSAYIH7ANCNFSM4QABHJ4A>
.
Activity
heitorlessa commentedon Aug 15, 2020
michaelbrewer commentedon Aug 15, 2020
Ok. Then I must have misunderstood the docs. I thought if you don't want to double patch you turn it off in the shared code but it will patch in the main handler file.
Currently I don't include it and it works. I guess it is a matter looking closely at the docs.
heitorlessa commentedon Aug 15, 2020
docs: clarify auto_patch as per #108
chore: update Tracer docs as per #108
heitorlessa commentedon Aug 15, 2020
@michaelbrewer When you can, could you please review the docs statement to make sure it's clearer? PR #109
Merge pull request #109 from heitorlessa/docs/tracer-reuse
heitorlessa commentedon Aug 16, 2020
Just released :) https://awslabs.github.io/aws-lambda-powertools-python/core/tracer/#reusing-tracer-across-your-code