You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Provisioned Concurrency (PC) in AWS Lambda, the service initializes and keeps active a number of execution environments so that a portion of the requests can be served by these already-warm environments.
As a Powertools for AWS customer using PC, I'd like the cold start metric, log key, and tracer annotation to correctly reflect whether a request is a cold start or not - which is not currently the case.
Solution/User Experience
Currently Logger, Metrics, and Tracer are not aware of Provisioned Concurrency (PC) because the state required to report cold starts in all of them is maintained internally and is dependent on the amount of requests seen by the utility.
Lambda provides an environment variable AWS_LAMBDA_INITIALIZATION_TYPE that can have three values in the Python runtime: provisioned-concurrency, snap-start or on-demand.
We could use this value to tweak our cold start detection logic to report a non-cold start (aka warm start) whenever PC is enabled.
This should not require any code changes from customers besides upgrading the packages to the latest version.
Use case
Original issue: aws-powertools/powertools-lambda-typescript#3723
When using Provisioned Concurrency (PC) in AWS Lambda, the service initializes and keeps active a number of execution environments so that a portion of the requests can be served by these already-warm environments.
As a Powertools for AWS customer using PC, I'd like the cold start metric, log key, and tracer annotation to correctly reflect whether a request is a cold start or not - which is not currently the case.
Solution/User Experience
Currently Logger, Metrics, and Tracer are not aware of Provisioned Concurrency (PC) because the state required to report cold starts in all of them is maintained internally and is dependent on the amount of requests seen by the utility.
Lambda provides an environment variable
AWS_LAMBDA_INITIALIZATION_TYPE
that can have three values in the Python runtime:provisioned-concurrency
,snap-start
oron-demand
.We could use this value to tweak our cold start detection logic to report a non-cold start (aka warm start) whenever PC is enabled.
This should not require any code changes from customers besides upgrading the packages to the latest version.
Alternative solutions
Acknowledgment
The text was updated successfully, but these errors were encountered: