-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Description
The way that nodejs instrumentation code is loaded does load the agent by a simple "require('newrelic')".
In a supported framework like Next.js transactions are reported correctly.
However, for custom instrumentation, one has to import the newrelic module first.
A simple require('newrelic') won't work because the newrelic module is installed in a custom path (something like /nri-nodejs--pod-name).
I can contribute a fix to that, but can't seem to find the source for the newrelic-node-init image.
Steps to Reproduce
- Install the nodejs operator and the required CR.
- In your code do any custom instrumentation (
newrelic.addCustomAttribute) - Also try doing
require('newrelic') - Run the pod and observe the newrelic startup logs to verify the agent is loaded
- Custom instrumentation crashes because
newrelicis undefined and the require also fails
Expected Behavior
Custom instrumentation to work as documented in the official docs by just importing (how?).
Relevant Logs / Console output
Your Environment
- node 18.18.2
- agent 12.25
Additional context
Metadata
Metadata
Assignees
Labels
No labels