New Relic APM Pro

Learn how to enable and use New Relic performance metrics and reports for your Drupal or WordPress site.


New Relic APM Pro offers a wide array of metrics that provide a nearly real-time look into the performance of a web application. Using New Relic not only makes it easy for you to monitor your performance, but it can also speed up the support process by helping our support team visualize corresponding performance and symptoms.

Agency DevOps Training

Get the most out of New Relic with help from the experts at Pantheon. We deliver custom workshops to help development teams master the platform and improve internal DevOps.

Supported Site Plans

All plans except for a Basic plan can use New Relic APM Pro. New Relic APM Pro is available to Sandbox site plans for developmental purposes, but New Relic APM Pro will not be available going live on a Basic plan.

Plans New Relic APM Pro Support
Sandbox
Basic
Performance
Elite

Activate New Relic APM Pro

Select the New Relic tab on your Site Dashboard, and click Activate New Relic Pro. Visit your site in the browser a couple of times to generate data in New Relic. After a few minutes pass, go to the New Relic workspace on your Dashboard, and click Go to New Relic.

New Relic is automatically enabled for all application containers added to the site, including Multidev environments.

Configure Ping Monitors for Availability

New Relic provides a free availability monitoring service within their Synthetics tool suite at the Lite service level. This basic monitoring check sends a request to designated URLs from configured locations at given intervals and alerts you via email when a response fails. To configure this service:

  1. Click New Relic > Go to New Relic from the target environment within the Site Dashboard on Pantheon.
  2. Select Synthetics from the menu bar at the top of the page.
  3. From the Monitors tab (default), click Add new, and enter the details for the URL you want to monitor.
  4. Select the locations you wish to check the site from. We recommend picking locations that correspond to your site's visitors to reduce the risk of false-positives due to long-distance networking snafus.
  5. Set the frequency for checks. We suggest 5 minutes.
  6. Provide an email address for notifications.
  7. Click Create my monitor.

Pantheon can provide New Relic ping monitoring for free as part of the service. However, more advanced monitoring — full browser testing, or scripted interactions — is only available to customers on an annual contract and requires an additional cost. Contact our sales team or your dedicated account manager for details.

Monitoring and Improving Performance

New Relic's Dashboard starts with a high-level breakdown of application performance by dividing response time into three segments in its main graph:

  1. PHP Execution
  2. Database Queries (MySQL or Redis)
  3. External Requests (e.g. calls to third pary APIs)

Depending on which area you need to optimize, you will dig in to different areas of data. For instance, a lot of time spent in the database could be the result of slow queries, or an elevated volume of queries overall.

For more information on using New Relic's features, we encourage you to read the New Relic APM docs, especially the pages on transactions and slow query details. You can find more information on using New Relic to investigate specific areas of performance below:

Focusing on Authenticated Users Only

If your site consists of mostly authenticated traffic, it can be useful to exclude anonymous users who are using your site's page cache. This technique will still capture form submissions, including logins and contact pages. Similar logic can be used to disable New Relic on certain paths, such as /admin in Drupal or /wp-admin in WordPress.

Drupal

To disable New Relic for anonymous traffic on Drupal-based sites, add the following to your sites/default/settings.php:

// Disable New Relic for anonymous users.
if (function_exists('newrelic_ignore_transaction')) {
  $skip_new_relic = TRUE;
  // Capture all transactions for users with a PHP session.
  // (SSESS is the session cookie prefix when PHP session.cookie_secure is on.)
  foreach (array_keys($_COOKIE) as $cookie) {
    if (substr($cookie, 0, 4) == 'SESS' || substr($cookie, 0, 5) == 'SSESS') {
      $skip_new_relic = FALSE;
    }
  }
  // Capture all POST requests so we include anonymous form submissions.
  if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $skip_new_relic = FALSE;
  }
  if ($skip_new_relic) {
    newrelic_ignore_transaction();
  }
}

WordPress

To disable New Relic for anonymous traffic on WordPress sites, add the following to your templates/<your_template>/functions.php:

// Disable New Relic for anonymous users.
if (function_exists('newrelic_ignore_transaction')) {
    $skip_new_relic = !is_user_logged_in();

    // Capture all POST requests so we include anonymous form submissions.
    if (isset($_SERVER['REQUEST_METHOD']) &&
        $_SERVER['REQUEST_METHOD'] == 'POST') {
        $skip_new_relic = FALSE;
    }

    if ($skip_new_relic) {
        newrelic_ignore_transaction();
    }
}

False Alarms

Availability monitoring services (e.g., Pingdom, New Relic Synthetics) function by periodically reaching out to sites to gauge availability. Some failures in availability do not require action and can be considered false alarms, such as failures due to internet routing or idle containers.

Internet Routing

A temporary routing issue between a particular monitoring service endpoint and one of our CDN Points of Presence (POPs) can result in an alert. The internet is a big place, and there's a lot of potential for intermittent packet loss between any two points, depending in the route taken. A single loss of access from one point to another does not always correlate to an issue with the site itself.

Tools like MTR can help to diagnose a routing issue.

Idle Containers

Containers on Pantheon are automatically spun down following a period of inactivity, then spun back up once a web request is made. Monitoring pings sent between the initial request and the completed spin-up may fail, but do not necessarily indicate an issue. For details, see All About Application Containers.

Support for Handling Alerts

Before opening a support ticket based on an alert, take the following actions:

  1. Refer to the alert message to confirm event reported (what monitor it came from, what triggered it, etc.).
  2. Determine whether the event was a false alarm.
  3. Once you have verified an alert to be outstanding, contact support and provide the following information:
    • Steps to reproduce the issue (including URLs or paths to files)
    • Environments affected (Multidev/Dev/Test/Live), if applicable
    • When the issue began
    • Error messages received
    • Links to screenshots or screencasts of the behavior, if necessary

    If the issue creating the alert stems from the Pantheon Platform, we will investigate and resolve. Alerts triggered by the site's code are not within Pantheon's scope of support. For details, see Getting Support.

New Relic Access

Your first visit to New Relic must be via the Go to New Relic button. Once you have successfully accessed the New Relic Dashboard, you may use the environment links to go directly to their corresponding New Relic page.

If you go to the New Relic Dashboard and see "You do not have permission to view this account"

  1. From the New Relic Dashboard, click on the User Account to the right.
  2. From the Dropdown, click Log Out.
  3. Back on the Pantheon Site Dashboard, click the Go to New Relic button.

If you click the Go to New Relic button and are instead sent to a log in screen

To troubleshoot this issue, try logging into the Pantheon Dashboard in an Incognito or Private window. The New Relic accounts are shared via SSO, so loading the page in a private window will force new sign-in credentials. If you can sign in this way, use the following steps to resolve access for your main browser session:

  1. Close all of your open New Relic tabs.
  2. Delete all of the New Relic cookies from your browser (support articles for Chrome or Firefox).
  3. Reload your Pantheon Dashboard.
  4. Click the Go to New Relic button.

If you are prompted to Set Up New Relic

If you try to access New Relic prior to any traffic reaching an environment, you will be prompted to set up New Relic.

  1. Visit one of your site pages.
  2. Close the tab, wait a few minutes.
  3. Click the Go to New Relic button.

Who is the New Relic account associated with?

  • If the site owner is a user, the site owner's name and email address is used to create the New Relic account.
  • If the site owner is an organization, the name and email address of the Pantheon user who activates New Relic is used to create the New Relic account. This user must be a member of the organization.

If you see "We're sorry, you haven't verified your email address yet."

After activating New Relic, a confirmation email will be sent to the site owner to complete the setup process. The account will need to be verified first before members of the site can access New Relic dashboard.

If the New Relic account holder, i.e. the site owner or user who activated the New Relic account for the site, did not receive the confirmation email, you can re-send the link by clicking "Forgot your password":

  1. On New Relic's login page, click Forgot your password?.
  2. Enter the email address of the site owner.
  3. Click Send my reset link.
  4. Open the email you will receive, click the reset link, and follow the prompts to access your account.

Contact Support if you are unsure what user the New Relic account is associated with and unable to identify where the password reset email has been sent.

Troubleshooting

Removing Multidev Environments in New Relic

After deleting a Multidev environment from your site, you'll need to manually remove them in New Relic.

  1. From your Dashboard, select the New Relic tab, and Open New Relic.
  2. From the New Relic menu bar, select APM > Applications.
  3. Wait until the color-coded health status turns gray, then select the app's gear icon.
  4. Select Delete app, and click the confirmation button.

Disable New Relic Browser Monitoring Agent

You may encounter situations where New Relic's Browser agent may interfere with other systems. For example, the JavaScript tag may cause Google AMP validator failures, such as The tag 'script' is disallowed except in specific forms. You can resolve many errors by disabling New Relic's Browser monitoring agent.

In this example we'll disable it on all AMP pages:

$path = $_SERVER['REQUEST_URI'];
$find = '?amp';
$pos = strpos($path, $find);
if ($pos !== false){
  if (function_exists('newrelic_disable_autorum')) {
    newrelic_disable_autorum();
  }
}

To isolate the disabling of New Relic to only AMP pages, the example logic checks the current request for ?amp. Adjust this example as needed based on your site's implementation of Google AMP and it's corresponding URL patterns.

It is important to note that this method is sensitive to call location. Most customers find success calling this method early in a transaction. For Drupal 8, this can be done using an event subscriber that listens to the kernel.request event for instance.

APM Availability Monitoring

Availability monitoring from APM is heavily outdated, and will not work with the Pantheon platform. As an alternative, you can use the free New Relic Synthetic Lite service using the steps provided above.

Frequently Asked Questions

How do I change the New Relic site owner now that our Pantheon site has a new site owner?

A New Relic account can have only one owner at any time. You must be the current account owner to change your role to someone who currently has an Admin role for the account. For more information, see New Relic's documentation.

At the bottom of any page, click Permalink. This will preserve the current time window and take the link recipient to the same page you're currently looking at.

How much is New Relic APM Pro?

Pantheon provides New Relic APM Pro for all site plans except Basic, at no cost. Purchase additional services or upgrade your New Relic account by reaching out to sales@newrelic.com.

Will turning on New Relic APM Pro slow my site down?

Basically no, New Relic will not make your site slower. There is a very small amount of overhead, but it's imperceptible. The amount of available metrics useful for debugging and improving performance far outstrips the negligible difference.

What is the difference between app server response time and browser page load time?

App server response time measures how the page was built on Pantheon, including PHP execution, database, Redis (if used). Browser page load time measures the additional time of client-side page rendering, DOM processing, and how long it took to transfer to the client. While a fast app server response time is optimal, a slow browser page load time indicates a bad user experience. Some causes are unaggregated or uncompressed scripts and stylesheets, invalid markup, or unoptimized client-side code (like JavaScript).

Can I use my existing New Relic license with my Pantheon site?

New Relic Pro is automatically provisioned for your site. Unfortunately, you cannot use your existing license.

Why are servers listed in New Relic with no data?

Because Pantheon's runtime matrix runs your application across many containers simultaneously, it's common to see old containers with no reporting data as your application shifts around. This is not a cause for concern.

Can I disable New Relic for a specific environment?

We don't recommend turning off New Relic for any one environment as it makes troubleshooting errors and performance issues more difficult. However, you can disable the New Relic Browser agent if you encounter a situation where it is interfering with other systems, and you can also write logic based on the environment.

See Also