Skip to content
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

feat(instrumentation-aws-lambda): take care of ESM based (.mjs) handlers #2508

Merged

Conversation

serkan-ozal
Copy link
Contributor

@serkan-ozal serkan-ozal commented Oct 28, 2024

Which problem is this PR solving?

Currently, ESM based handlers with .mjs file extension are not taken care of by AWS Lambda instrumentation, but ESM based handlers are supported since long time (https://aws.amazon.com/tr/about-aws/whats-new/2022/01/aws-lambda-es-modules-top-level-await-node-js-14/).

Short description of the changes

For the fix, while handler file is being resolved, in addition to .js and .cjs file extensions, .mjs file extension is also checked.

This PR is the contrib counter part of the open-telemetry/opentelemetry-js#5094

@serkan-ozal serkan-ozal requested a review from a team as a code owner October 28, 2024 17:33
@serkan-ozal serkan-ozal force-pushed the fix/aws-lambda/take-care-of-esm branch from fea7f36 to 118eb8e Compare October 28, 2024 17:34
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.77%. Comparing base (80d0c74) to head (c0be5ce).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...-instrumentation-aws-lambda/src/instrumentation.ts 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2508      +/-   ##
==========================================
- Coverage   90.79%   90.77%   -0.02%     
==========================================
  Files         169      169              
  Lines        8009     8015       +6     
  Branches     1632     1632              
==========================================
+ Hits         7272     7276       +4     
- Misses        737      739       +2     
Files with missing lines Coverage Δ
...-instrumentation-aws-lambda/src/instrumentation.ts 93.60% <71.42%> (-0.98%) ⬇️

@trentm trentm changed the title Take care of ESM based (.mjs) handlers for the AWS Lambda instrumentation feat(instrumentation-aws-lambda): take care of ESM based (.mjs) handlers Oct 28, 2024
@raphael-theriault-swi
Copy link
Contributor

Looks like a subset of #2000, thanks for addressing the issue in the instrumentation code wrt. absolute paths !

@serkan-ozal serkan-ozal force-pushed the fix/aws-lambda/take-care-of-esm branch from 118eb8e to 1025833 Compare November 6, 2024 17:37
@trentm
Copy link
Contributor

trentm commented Nov 6, 2024

@pichlermarc I haven't merged this yet, in case OP would like to respond to my comments above. I think it is good to merge if you are doing a release that could include this tomorrow.

@trentm
Copy link
Contributor

trentm commented Nov 6, 2024

@raphael-theriault-swi Ah, sorry I hadn't seen your earlier PR ... and I hadn't really been digging into Lambda-related PRs. I'll try to take a look in the next few days.

@raphael-theriault-swi
Copy link
Contributor

@trentm I'd just go with whatever is easier to review and get out of the doors, ultimately the important part is ESM support

@serkan-ozal
Copy link
Contributor Author

@trentm Thanks for the review. I have updated PR according to your comments

@trentm trentm merged commit 0309cae into open-telemetry:main Nov 7, 2024
24 of 25 checks passed
@dyladan dyladan mentioned this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants