Skip to content

feat(commons): make utilities aware of provisioned concurrency #3724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 19, 2025

Conversation

dreamorosi
Copy link
Contributor

@dreamorosi dreamorosi commented Mar 13, 2025

Summary

Changes

Please provide a summary of what's being changed

This PR modifies the logic used to detect cold starts by making it take into account the value of the AWS_LAMBDA_INITIALIZATION_TYPE env variable, which can have on-demand or provisioned-concurrency as values according to the environment in which the function is being run.

Depending on the value, we either use the original logic (on-demand) or always default to false, meaning not a cold start, when running under provisioned concurrency.

This feature allows customers to have traces, logs, and metrics that are more accurate to the environment they're running their functions within.

The PR also introduces a new e2e test suite in Logger that covers some advanced cases that have been introduced in the past weeks, including this one:

  • Log buffering enabled with flush on error (both manually on logger.error and automatically on uncaught error)
  • Correlation ID injection (both manually and automatically)
  • Cold start detection for provisioned concurrency (always false)

Here's an example of a passing run: https://github.com/aws-powertools/powertools-lambda-typescript/actions/runs/13862082184

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3723


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Mar 13, 2025
@boring-cyborg boring-cyborg bot added commons This item relates to the Commons Utility tests PRs that add or change tests labels Mar 13, 2025
@pull-request-size pull-request-size bot added the size/M PR between 30-99 LOC label Mar 13, 2025
@github-actions github-actions bot added the feature PRs that introduce new features or minor changes label Mar 13, 2025
@dreamorosi dreamorosi force-pushed the feat/provisioned_concurrency branch from aeaf638 to e7c141e Compare March 14, 2025 15:12
@boring-cyborg boring-cyborg bot added the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Mar 14, 2025
@pull-request-size pull-request-size bot added size/L PRs between 100-499 LOC and removed size/M PR between 30-99 LOC labels Mar 14, 2025
@dreamorosi dreamorosi requested a review from am29d March 14, 2025 17:37
@dreamorosi dreamorosi marked this pull request as ready for review March 14, 2025 17:42
@boring-cyborg boring-cyborg bot added the automation This item relates to automation label Mar 14, 2025
@dreamorosi dreamorosi removed the request for review from am29d March 14, 2025 17:53
@dreamorosi dreamorosi marked this pull request as draft March 14, 2025 17:53
@dreamorosi
Copy link
Contributor Author

Converted this back to draft because I wanted to extract the e2e test changes, but I'll do it on Monday.

@dreamorosi dreamorosi force-pushed the feat/provisioned_concurrency branch from 5436bf3 to 8b934e3 Compare March 19, 2025 10:49
@pull-request-size pull-request-size bot added size/M PR between 30-99 LOC and removed size/L PRs between 100-499 LOC labels Mar 19, 2025
@dreamorosi dreamorosi requested a review from am29d March 19, 2025 11:09
@dreamorosi dreamorosi marked this pull request as ready for review March 19, 2025 11:09
@dreamorosi
Copy link
Contributor Author

@dreamorosi dreamorosi removed the request for review from am29d March 19, 2025 12:42
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small comment, but feel free to ignore! Approved.

@dreamorosi dreamorosi merged commit c28e45e into main Mar 19, 2025
81 checks passed
@dreamorosi dreamorosi deleted the feat/provisioned_concurrency branch March 19, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation commons This item relates to the Commons Utility dependencies Changes that touch dependencies, e.g. Dependabot, etc. feature PRs that introduce new features or minor changes size/M PR between 30-99 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: make cold start aware of Provisioned Concurrency
2 participants