Add Node.js New Relic agent with an on/off switch via NEW_RELIC_ENABLED in .env. Uses a preload script (-r newrelic-preload.js) so the agent loads before all other modules. Configured entirely through environment variables — no newrelic.js config file needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8 lines
224 B
JavaScript
8 lines
224 B
JavaScript
// Conditionally load the New Relic agent before any other modules.
|
|
// Controlled by the NEW_RELIC_ENABLED environment variable (.env).
|
|
'use strict';
|
|
|
|
if (process.env.NEW_RELIC_ENABLED === 'true') {
|
|
require('newrelic');
|
|
}
|