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

Refactor lib/transaction/tracer/index.js to reduce duplicate logic #2504

Open kmudduluru opened 3 months ago

kmudduluru commented 3 months ago

Description

There currently is a lot of duplicated code in lib/transaction/tracer/index.js, specifically around input validation and wrapping of functions. We should abstract some of this duplicate logic into helper methods that allow us to write and test the logic once, and reuse in multiple places

Acceptance Criteria

Reduce duplicated logic for constructing a wrapper function(wrapFunctionNoSegment, wrapFunctionFirstNoSegment, wrapFunctionLast, wrapFunctionFirst, wrapFunction, wrapSyncFunction, and wrapCallback)

https://new-relic.atlassian.net/browse/NR-134520 see this ticket for any additional context

workato-integration[bot] commented 3 months ago

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