rejoice icon indicating copy to clipboard operation
rejoice copied to clipboard

Question: rejoice -r and newrelic.js

Open ambrons opened this issue 11 years ago • 4 comments

I'm not sure if you're familiar with newrelic.js for Hapi or how it's implemented. However in the simpliest of implementations it only requires the inclusion of require('newrelic'); in you hapi server.

I've tried something similar to the following:

rejoice -c manifest.json -r 'path/to/newrelic'

Unfortunately I received the following response from the newrelic agent log.

{"v":0,"level":40,"name":"newrelic","hostname":"hostname","pid":1549,"time":"2015-09-18T21:52:24.200Z","msg":"The newrelic module must be the first module required.\nThe following modules were required before newrelic and are not being instrumented:\n\thapi"}

Seems like it's not possible and that my only option is to include there require('newrelic') either in a new hapi plugin definition, use a start.js script, or include the require('newrelic') in an existing plugin.

Thoughts?

ambrons avatar Sep 19 '15 02:09 ambrons

Seems like this should work. I don't think its 'path/to/newrelic', it should just be newrelic and there should be a newrelic directory in the same directory rejoice is called. Can you try just 'newrelic' without the path? Let me know if you get the same result. I also assume that no where in your manifest.json you have a plugin that refers to newrelic (as to not confuse if the error is coming from -r or just another plugin).

lloydbenson avatar Sep 19 '15 11:09 lloydbenson

Correct Lloyd, We do not have any plugins or code that makes reference to new relic anywhere else.

I've attempted to use -r 'newrelic' and this produced an error. I'll update with the error later. It's possible because newrelic is not referenced in the top-level package.json in the directory that rejoice is called from.

I'll do some more research. and get back to you.

ambrons avatar Sep 20 '15 08:09 ambrons

I'm having trouble with this as well. I can get newrelic loaded, but it MUST be loaded BEFORE hapi in order to instrument it.

mikefrey avatar Oct 12 '15 19:10 mikefrey

This has now been published as 2.2.1.

lloydbenson avatar Oct 13 '15 12:10 lloydbenson