New Relic is an APM software that monitors application performance and sends notifications if it finds any glitches. APM reveals what is happening deep in your code with end to end transaction tracing and a variety of color-coded charts and reports.

This blog will show you how to set up New Relic in Magento 2.

Step 1: Sign Up for a New Relic Account

  1. Go to the New Relic website and sign up for an account. 
  2. Complete the information as directed. When suggested, select the product that you want to set first.
  3. While you are in your account, locate the following credentials that you will need to complete the configuration:
  • Account ID: On the New Relic account dashboard, the Account ID is the number in the URL after: /accounts
  • Application ID: On the New Relic account dashboard, click APM. Then select Application and select your application. The Application ID is the number in the URL after: /applications/
  • New Relic API Key: On the New Relic account dashboard, select Account Settings. Then click API Keys in the panel on the left below Integrations. You can create a new API key, restore or delete your API key on this page.
New relic in magento 2: New relic api setting
                                             New relic api setting
New relic in magento 2: New relic api key
                                                      New relic api key
  • Insights API Key: On the New Relic account dashboard, select Insights. in the panel on the left below Administration, select API Keys. Your Insights API Key(s) display on this page. To create a key, select the plus sign (+) next to Insert Keys

Step 2: Install the New Relic Agent on Your Server

To gather and transmit data using New Relic APM Pro, you have to install the PHP agent on your server.

Step 3: Configure Your Store

From the Admin sidebar, choose Stores. Below Settings, select Configuration

In the options table on the left below General, click New Relic Reporting and continue with following:

Configure Your Store
                                                    Configure Your Store

Set Enable New Relic Integration to β€œYes”

  • In the Insights API URL, replace the percent (% symbol with your New Relic Account ID)
  • Input all required information: Account ID, Application ID, API Key, Insights API Key.
  • In the New Relic Application Name field, enter a name to identify the configuration for internal reference.
  • (Optional) For the Send Adminhtml and Frontend as Separate Apps field, select Yes to send collected data for the storefront and Admin as separate apps to New Relic. This option requires a name entered for the New Relic Application Name.
  • Save Config.

Step 4: Enable Cron for New Relic Reporting

setup New Relic enable cron
  • Expand the Cron section
  • Set Enable Cron to ”Yes” and click Save Config.

From now, you will be able to track web transaction time, MySQL queries, and key transactions, and you could have code-level visibility performance tracking that allowed you to analyze your code, database queries, errors, and similar.

On the APM Application page, use the New Relic APM Overview to view information about your application

setup New Relic APM overview