newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
971 stars 399 forks source link

[spike] Update shim to use Proxy instead of assigning a patched function #2499

Open kmudduluru opened 2 months ago

kmudduluru commented 2 months ago

Description

Javascript created a standard for wrapping objects Proxy and Reflect(link). Our agent predates these constructs so our shim API saves a reference to a function and re-assigns it. This could cause issues in cases where functions lack a setter. In an effort to stay current with our solutions we should update our patching to instead use Proxy and Reflect when calling constructor.

Notes: We might be able to just abstract the traps in wrapReturn and re-use everywhere.

Internal ticket for this issue

workato-integration[bot] commented 2 months ago

https://new-relic.atlassian.net/browse/NR-304761