Closed
Description
Expected Behaviour
When metric decorator is added on top of the lambda handler to capture Cold Start metric, we should not get any warning message for cold or warm lambda invocation.
Current Behaviour
When metric decorator is added on top of the lambda handler to capture Cold Start metric, we get a warning message. No metrics to publish, skipping
.
Code snippet
@metrics.log_metrics(capture_cold_start_metric=True)
def lambda_handler(event: dict, context: LambdaContext):
...
Possible Solution
No response
Steps to Reproduce
- Add @metrics.log_metrics(capture_cold_start_metric=True) to the lambda handler
- Ensure no more metrics is added in the lambda
- Run Lambda
UserWarning: No metrics to publish, skipping
appears in function log
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
Lambda Layers
Debugging logs
No response