Description
Bug description
In #1085 it has been reported that Logger is affected by a bug that causes the decorator to not properly await
the decorated method. During the review of the PR that is expected to fix #1085, @ijemmy correctly pointed out that this same faulty behavior also affects Tracer's decorators.
In the case of Tracer the actions performed after the decorated method has returned are silent in the sense that they don't produce any output. This made it harder for customers or maintainers to spot the bug.
Expected Behavior
The decorated method should be awaited correctly and all cleanup/post return actions should be performed after the decorated method has returned.
Current Behavior
The decorated method is not awaited and in case of async methods this might cause the segment created for the method to be closed too early.
Possible Solution
Await the decorated methods. In the case of non-async method this will result in a no-op so it shouldn't impact these methods.
Steps to Reproduce
N/A
Environment
- Powertools version used: 1.2.1 or earlier
- Packaging format (Layers, npm): All
- AWS Lambda function runtime: All
- Debugging logs: N/A