Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusing Tracer across your code disables patching boto3 #108

Closed
michaelbrewer opened this issue Aug 15, 2020 · 5 comments
Closed

Reusing Tracer across your code disables patching boto3 #108

michaelbrewer opened this issue Aug 15, 2020 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@michaelbrewer
Copy link
Contributor

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.py
from aws_lambda_powertools import Tracer
from app import shared

tracer = Tracer(service="payment")

@tracer.capture_lambda_handler
def handler(event, context):
     pass
# shared.py
from 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
@michaelbrewer michaelbrewer added bug Something isn't working triage Pending triage from maintainers labels Aug 15, 2020
@heitorlessa
Copy link
Contributor

heitorlessa commented Aug 15, 2020 via email

@michaelbrewer
Copy link
Contributor Author

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
Copy link
Contributor

heitorlessa commented Aug 15, 2020 via email

heitorlessa referenced this issue in heitorlessa/aws-lambda-powertools-python Aug 15, 2020
heitorlessa referenced this issue in heitorlessa/aws-lambda-powertools-python Aug 15, 2020
@heitorlessa
Copy link
Contributor

heitorlessa commented Aug 15, 2020

@michaelbrewer When you can, could you please review the docs statement to make sure it's clearer? PR #109

heitorlessa added a commit that referenced this issue Aug 16, 2020
docs: clarify Tracer auto_patch as per #108
@heitorlessa heitorlessa added documentation Improvements or additions to documentation area/tracer and removed bug Something isn't working triage Pending triage from maintainers labels Aug 16, 2020
@heitorlessa heitorlessa self-assigned this Aug 16, 2020
@heitorlessa
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants