Skip to content

Reusing Tracer across your code disables patching boto3 #108

Closed
@michaelbrewer

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

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions