feat(nodejs): bundling with webpack #1679
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR, core (
wrapper.js
and most) of the OTEL AWS Lambda Node.js layer is bundled (tree-shaken and minified) with Webpack. So, this significantly reduces AWS Lambda coldstart delay of the OTEL AWS Lambda Node.js layer.Additionally, with this PR, users can also disable metrics and logs by
OTEL_METRICS_EXPORTER=none
andOTEL_LOGS_EXPORTER=none
to cut some more (~30 ms
) coldstart delay if they don't need metrics and logs, but just traces.According to my experiments,
~220 ms
from~550 ms
:60%
coldstart reduction (190 ms
if metrics and logs are disabled as described above)471 KB
from8.9 MB
:95%
package size reductionThere are still improvements we can do over this:
opentelemetr-js
andopentelemetry-js-contrib
repositories, but have not released and used in the Lambda layer yet.opentelemetr-js
andopentelemetry-js-contrib
repositories waiting for review.wrapper.js
) and reuse it without compiling during coldstart.Hopefully, with all these improvements, OTEL AWS Lambda Node.js layer coldstart overhead will be down to two digit ms (
< 100 ms
).Besides that, we also need some improvements in the OTEL Lambda collector extension as it adds additional
270-280 ms
delay to the coldstart.