Skip to content

Why is Lambda Duration metric including Cold Start Duration for docker image runtimes?

1

Hey, there!

I'm using a Docker image (public.ecr.aws/lambda/provided:al2-x86_64) along with AWS Lambda Web Adapter and even though it's said that duration excludes cold starts, I'm seeing it in the duration metric.

Duration definition: Definition of duration

The metric: Metric image

We have two different metrics being mixed in the same metric in the image, the initialization duration first, which is the highest one being collected, and the actual duration, which is the second and lowest one.

Is this expected? I didn't find anything in the documentation which would provide better explanation on this.

asked 2 years ago420 views

1 Answer
2
Accepted Answer

Hello,

The behavior you're seeing is expected for your use case, which is considered to be using a custom runtime. According to the custom runtimes documentation, "Initialization counts towards billed execution time and timeout.". This means that the "billed duration" (i.e. the "Duration" metric) would equal the invocation duration + init duration. The metrics you're seeing in the "Most recent 1000 invocations" panel are extracted from the logs entries.

AWS

answered 2 years ago

EXPERT

reviewed a year ago

  • Ohhhhhh, I was not expecting such a subtle message about it, but thinking like this, it makes total sense. I hope the Duration metric would be show just invocation in the future, that would be awesome, but for now, the metric filter will have to do xD. Thanks!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.