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

fix: Updated shimmer to handle instrumenting named and default exports of CommonJS modules in ESM #1894

Merged
merged 4 commits into from Dec 4, 2023

Conversation

jsumners-nr
Copy link
Contributor

This PR resolves #1821.

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (31dc717) 96.87% compared to head (b47a52c) 96.88%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1894   +/-   ##
=======================================
  Coverage   96.87%   96.88%           
=======================================
  Files         209      209           
  Lines       39774    39863   +89     
=======================================
+ Hits        38533    38622   +89     
  Misses       1241     1241           
Flag Coverage Δ
integration-tests-16.x 78.69% <46.77%> (-0.06%) ⬇️
integration-tests-18.x 78.97% <46.77%> (-0.06%) ⬇️
integration-tests-20.x 78.98% <46.77%> (-0.06%) ⬇️
unit-tests-16.x 90.88% <60.00%> (-0.10%) ⬇️
unit-tests-18.x 90.86% <60.00%> (-0.10%) ⬇️
unit-tests-20.x 90.86% <60.00%> (-0.10%) ⬇️
versioned-tests-16.x 73.78% <100.00%> (+0.03%) ⬆️
versioned-tests-18.x 73.78% <100.00%> (+0.03%) ⬆️
versioned-tests-20.x 73.79% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mrickard
mrickard previously approved these changes Dec 4, 2023
Copy link
Member

@mrickard mrickard left a comment

Choose a reason for hiding this comment

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

LGTM, and much more readable. @bizob2828 should weigh in as well.

Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

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

overall looks good. I'm not sure of the impact of proxying proxies but appears to work with our versioned tests. I do have a few comments and small things that need addressed

bin/macos-firewall.sh Show resolved Hide resolved
test/unit/util/codec.test.js Outdated Show resolved Hide resolved
lib/shimmer.js Outdated Show resolved Hide resolved
lib/shimmer.js Show resolved Hide resolved
lib/instrumentation/pg.js Outdated Show resolved Hide resolved
@jsumners-nr
Copy link
Contributor Author

I'm not sure of the impact of proxying proxies but appears to work with our versioned tests.

Frankly, it's a terrible idea. But we need to double up the decoration for CJS imported as ESM, otherwise we have to educate users that the imports do not work as they expect. I do think the IITM team is open to moving this work into the IITM module. So I'm going to work up a patch over there that will do the same thing and see if we can then simplify here. But I am convinced we need the symbol added in this implementation and I do not think they are open to that bit.

@bizob2828 bizob2828 changed the title fix: Resolve Winston ESM instrumentation issues fix: Updated shimmer to handle instrumenting named and default exports of CommonJS modules in ESM Dec 4, 2023
@jsumners-nr jsumners-nr merged commit 9f7979c into newrelic:main Dec 4, 2023
23 checks passed
Node.js Engineering Board automation moved this from Needs PR Review to Done: Issues recently completed Dec 4, 2023
@jsumners-nr jsumners-nr deleted the issue-1821 branch December 4, 2023 19:32
@github-actions github-actions bot mentioned this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Node.js Engineering Board
  
Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

ESM loader has multiple issues in v11
3 participants