Skip to content

improve warning message on Capturing ColdStart metrics #1926

Closed
@amirkaws

Description

@amirkaws

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions