Skip to content

New Relic for Node.js

After New Relic is enabled 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.
  • Enabling New Relic on Node.js application containers will result in a moderate increase in resource usage.
  • If New Relic is enabled for a Node.js site’s WordPress backend environment, and both environments are hosted at VIP, the Node.js application environments and 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.

New Relic browser monitoring

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

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

Prerequisites

  • Only customers with an Enhanced Support package, a Premier Support package, and some customers on legacy contracts can enable Browser Monitoring Lite.
  • New Relic must already be enabled on the environment before Browser Monitoring Lite can be enabled.

Eligible customer can enable browser monitoring on a Node.js environment by following 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: February 06, 2024

Relevant to

  • Node.js