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

Unable to instrument multiple version of the same module #1798

Closed
bizob2828 opened this issue Oct 5, 2023 · 1 comment · Fixed by #1799
Closed

Unable to instrument multiple version of the same module #1798

bizob2828 opened this issue Oct 5, 2023 · 1 comment · Fixed by #1799
Assignees
Labels

Comments

@bizob2828
Copy link
Member

Description

In version v10 of Node.js agent, we added the ability to instrument a module more than once. This shifted indicators of if a module was instrumented from the export to the hook. It was discovered that if you have multiple versions of a module that is instrumented in an application the 2nd instance never registers instrumentation.

Steps to Reproduce

  1. Create an application that contains multiple versions of same module.
  2. Try to require both versions and verify the instrumentation is registered.

Assumption: express 4.18.2 is installed, and express 4.18.1 is installed into test-mod

const newrelic = require('newrelic')
const symbols = require('newrelic/lib/symbols')
const express = require('express')

const testMod = require('test-mod/node_modules/express')

console.log('Is express wrapped?', !!express.application.use[symbols.wrapped])
console.log('Is different version of express wrapped?', !!testMod.application.use[symbols.wrapped])
Is express wrapped? true
Is different version of express wrapped? false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
1 participant