Skip to content

Reusing Tracer across your code disables patching boto3Β #108

Closed

Description

@michaelbrewer

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

Activity

  1. heitorlessa commented on Aug 15, 2020

    @heitorlessa
    Contributor
  2. michaelbrewer commented on Aug 15, 2020

    @michaelbrewer
    ContributorAuthor

    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.

  3. heitorlessa commented on Aug 15, 2020

    @heitorlessa
    Contributor
  4. heitorlessa commented on Aug 15, 2020

    @heitorlessa
    Contributor

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

  5. added a commit that references this issue on Aug 16, 2020
  6. added
    documentationImprovements or additions to documentation
    and removed
    bugSomething isn't working
    triagePending triage from maintainers
    on Aug 16, 2020
  7. self-assigned this
    on Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions