Closed jsumners-nr closed 3 weeks ago
See the conversation in https://github.com/newrelic/node-newrelic/pull/2421. Basically, the following needs to be refactored in order to satisfy the SonarQube linter: https://github.com/newrelic/node-newrelic/blob/599072b43b77a8c11c9ef414b08dfe6e04bca9d2/lib/instrumentation/pino/pino.js#L18-L95
Prior to opening the PR for review, I attempted:
function instrument(shim, tools) { // snip shim.wrap(tools, 'asJson', function wrapJson(shim, asJson) { return wrappedAsJson.bind({ shim, agent, symbols, asJson, metrics, config}) } } function wrappedAsJson() { const { shim, agent, symbols, asJson, metrics, config } = this // implementation }
But that won't work because wrappedAsJson needs this to be bound to the instrumented instance of Pino.
wrappedAsJson
this
https://new-relic.atlassian.net/browse/NR-298951
See the conversation in https://github.com/newrelic/node-newrelic/pull/2421. Basically, the following needs to be refactored in order to satisfy the SonarQube linter: https://github.com/newrelic/node-newrelic/blob/599072b43b77a8c11c9ef414b08dfe6e04bca9d2/lib/instrumentation/pino/pino.js#L18-L95
Prior to opening the PR for review, I attempted:
But that won't work because
wrappedAsJson
needsthis
to be bound to the instrumented instance of Pino.