Skip to content

Conversation

@ezhang6811
Copy link
Contributor

@ezhang6811 ezhang6811 commented Apr 2, 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, andinstall-externals.sh.

Trace Map for CJS handler:
image

Trace Map for ESM handler:
image

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

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 April 2, 2025 17:49
Copy link
Contributor

@jj22ee jj22ee left a comment

Choose a reason for hiding this comment

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

Changes look good.

Can you list out which of these files are directly copied/modified from OTel's solution, and can you add images of the Trace map for both CJS and ESM Lambda handlers?

@ezhang6811
Copy link
Contributor Author

Changes look good.

Can you list out which of these files are directly copied/modified from OTel's solution, and can you add images of the Trace map for both CJS and ESM Lambda handlers?

Description updated. I went back and removed the loader scripts since they weren't needed to instrument either handler.

jj22ee
jj22ee previously approved these changes Apr 4, 2025
@ezhang6811 ezhang6811 merged commit 3bece0c into aws-observability:main Apr 4, 2025
9 checks passed
@ezhang6811 ezhang6811 deleted the zhaez/refactor-webpack 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.

3 participants