Skip to content

New Relic for Node.js

After New Relic is enabled by VIP Support for a Node.js environment, the New Relic NPM package must be installed in the Node.js application.

  1. Install the New Relic NPM package:
    npm install --save newrelic
  2. Require the package at the top of the application’s entrypoint:
    require( 'newrelic' ); // or import 'newrelic';

The application’s entrypoint is the file called to start the Node.js application. Loading New Relic as early as possible is crucial for allowing it to monitor the entire application.

Caution

VIP configures New Relic automatically using environment variables. Do not configure the New Relic agent via newrelic.js or attempt to override the environment variables.

  • Once fully installed, New Relic will be enabled on all app containers of a Node.js environment and is configured to monitor all requests to that environment.
  • If New Relic is enabled for a Node.js site’s WordPress backend environment, and both environment’s are hosted at VIP, the Node.js application environments and the the WordPress application environments will be accessible from within the same New Relic dashboard.
  • The Node.js agent API can be used to create custom errors and metrics and report them to New Relic.

Enabling New Relic browser monitoring

By default, New Relic browser monitoring is disabled on new VIP Platform environments.

Browser monitoring in New Relic One measures the speed and performance of end users as they navigate to a site from different web browsers, devices, operating systems, and networks.

To enable browser monitoring on a Node.js environment, follow the instructions for setting up New Relic’s browser monitoring agent.

Local development

The environment variables supplied by VIP will not be present in a local environment. As a result, when a local development environment is started, a warning that New Relic is not available may appear in the console. This warning can be ignored.

Last updated: May 13, 2022