Skip to content

Conversation

@ezhang6811
Copy link
Contributor

@ezhang6811 ezhang6811 commented Mar 21, 2025

Description of changes:
This PR is a rehash of #163 with some minor changes reverted after several autoinstrumentation package dependencies were upgraded in #168. The changes suggested by the unaddressed comments in the previous PR are addressed here.

The primary change made to reduce the cold start time was to bundle the ADOT autoinstrumentation package with webpack instead of using the TS compiler. Using the same build targets as the upstream (see this PR), the cold start performance of the layer was improved by about 50%, from ~765ms to ~385ms.

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

@ezhang6811 ezhang6811 requested a review from a team as a code owner March 21, 2025 00:33
@ezhang6811 ezhang6811 merged commit 82e563c into aws-observability:main Mar 22, 2025
9 checks passed
ezhang6811 added a commit that referenced this pull request Apr 4, 2025
*Issue #, if available:*

*Description of changes:*
#171 introduced a bug where the Lambda server span was no longer
produced in trace map for ESM-based handlers. This PR fixes the bug and
now bundles the lambda layer directly instead of the autoinstrumentation
package. The size of the bundled layer is now ~920KB, a nearly 94%
reduction in size from the original 14.5MB.

The following files were copied from upstream to support Lambda layer
bundling with minor changes: `webpack.config.js`,
`tsconfig.webpack.json`, `tsconfig.esm.json`, and`install-externals.sh`.

Trace Map for CJS handler:

![image](https://github.com/user-attachments/assets/fe319402-db2b-41c9-b28d-14c6953ac2ba)

Trace Map for ESM handler:

![image](https://github.com/user-attachments/assets/d70f91f0-2c49-40b0-b3e4-4270ba39648f)

Trace Map for ESM handler prior to fix (with bug):

![image](https://github.com/user-attachments/assets/fa0e5726-e485-4029-9b01-9e68cf6d7a5e)


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
@ezhang6811 ezhang6811 deleted the zhaez/cold-start-improvements branch November 4, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants