-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tracer): support methods with the same name (ABCs) by including …
…fully qualified name in v2 (#1486) Co-authored-by: Heitor Lessa <[email protected]> Co-authored-by: Ruben Fonseca <[email protected]>
- Loading branch information
1 parent
64513d9
commit 3690943
Showing
5 changed files
with
120 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from abc import ABC, abstractmethod | ||
from uuid import uuid4 | ||
|
||
from aws_lambda_powertools import Tracer | ||
from aws_lambda_powertools.utilities.typing import LambdaContext | ||
|
||
tracer = Tracer() | ||
|
||
|
||
class MainAbstractClass(ABC): | ||
@abstractmethod | ||
def get_all(self): | ||
raise NotImplementedError | ||
|
||
|
||
class Comments(MainAbstractClass): | ||
@tracer.capture_method | ||
def get_all(self): | ||
return [{"id": f"{uuid4()}", "completed": False} for _ in range(5)] | ||
|
||
|
||
class Todos(MainAbstractClass): | ||
@tracer.capture_method | ||
def get_all(self): | ||
return [{"id": f"{uuid4()}", "completed": False} for _ in range(5)] | ||
|
||
|
||
def lambda_handler(event: dict, context: LambdaContext): | ||
|
||
todos = Todos() | ||
comments = Comments() | ||
|
||
return {"todos": todos.get_all(), "comments": comments.get_all()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters