-
Notifications
You must be signed in to change notification settings - Fork 42
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: Refactored wrapper to load and wrap handler early #187
Conversation
Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
…per is loaded Signed-off-by: mrickard <[email protected]>
…ore the wrapper is loaded Signed-off-by: mrickard <[email protected]>
…d as esm Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
…sync code paths Signed-off-by: mrickard <[email protected]>
…g wrapping before applying args Signed-off-by: mrickard <[email protected]>
Signed-off-by: mrickard <[email protected]>
…ndler definition in a function to be called in tests. Signed-off-by: mrickard <[email protected]>
…state unit test files. Restructured ESM unit tests to inspect errors from failures in the wrapping/import phase Signed-off-by: mrickard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: it seems this is being handled in some other way. Disregard this request.
Can we update the following lines to include npm install --production
?:
npm install --prefix $BUILD_DIR newrelic@latest |
npm install --prefix $BUILD_DIR newrelic@latest |
npm install --prefix $BUILD_DIR newrelic@latest |
npm install --prefix $BUILD_DIR newrelic@latest |
Signed-off-by: mrickard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I have enough context to comment on is some effective globals in the tests, but I wouldn't block for that. Overall, it looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall it looks good. One question but nice work refactoring this 👏🏻
|
||
t.test('should wrap handler in transaction', async(t) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need a unit test for lambda in cjs with callback or are we just relying on the integration tests for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're relying on integration tests with the functions that return callbacks. For those, the issue hasn't been loss of instrumentation, but an interruption in the return value, so we test that explicitly for the callback-returning functions.
This PR refactors the Node wrapper file and updates tests. A previous PR introduced support for no-code-change instrumentation of ESM functions, but handled CJS functions asynchronously, which was not compatible with callback-returning Lambda functions. A later PR resolved that issue, but deferred wrapping the user's Lambda handler until invocation time. This PR wraps handlers on load rather than on invocation, and preserves a synchronous path for CJS functions along with an asynchronous path for ESM functions.