Skip to content

Backgrounds

How-to Guides

Technical References

Tools for Site Management /

New Relic

New Relic is available for clients running on our VIP Go platform. New Relic is an application performance monitoring (APM) tool and on VIP Go, you can use it to monitor the PHP (WordPress) code and browser performance of your site or application.

Uses and capabilities

One of the key benefits of an APM product is the observability of the custom application code that is running, and the availability of easy to access traces that shed light on performance or functionality issues in your application code or in WordPress core code.

It’s not a panacea, but it can be a powerful tool to use to both understand the average response times of different URL routes in your application, and to identify anomalies such as slow queries, slow remote requests, or generally slow URL routes.

  • It shows overall performance of your backend and estimates user happiness with response times (New Relic calls this Apdex)
  • You can compare against previous week or other history,
  • You can enable alerts for changes to the Apdex score.
  • You can drill into specific parts of the application to see where the bottlenecks are.
  • You can use it to assess how your application performs during peak traffic times.
  • You can review traces to identify inefficiencies or slow database queries and correct them.
  • It also displays a sampling of fatal errors and PHP warnings.

Using New Relic on VIP Go

If your team would like to use New Relic, please contact us and we’ll be happy to arrange access for you. We do not charge for access to New Relic.

This is an opt-in service, since New Relic Monitoring does introduce an extra performance cost of 10-12%.

The New Relic plan we run is as follows:

  • Web Pro Annual — this is the PHP application monitoring that covers your WordPress application code
  • Mobile Lite
  • Insights Free
  • Browser Lite
  • Synthetics Lite

The differentiation mainly affects the retention of monitoring data, with Pro elements retaining data for longer than Lite elements.

New Relic installation on VIP infrastructure

Upon activation, New Relic is installed on one web container per WordPress environment. New Relic may be enabled on up to 50% of web containers for any environment upon request, with a maximum number of 15 New Relic instances per environment.  Please open a support ticket if you’d like New Relic installed with this option.

By default, the New Relic agent is not activated on CLI containers for WordPress environments; these are the containers that run WP-CLI commands and also run WordPress Cron events. If it is important to monitor the performance of your Cron events and WP-CLI commands, please get in touch and we can activate the New Relic activation on the CLI containers for any of your environments.

The New Relic agent is not installed on any other parts of our infrastructure (i.e., the VIP CDN or database containers).

Security and obfuscation

Due to the possibility of exposing private attributes of requests, some of the query parameters are intentionally obfuscated in New Relic’s UI. You’ll see substitute question marks or no query params in traces or database queries. Some of these can be selectively re-enabled, but we urge caution when doing so – only allow the values of query parameter keys that are always innocuous.

Number of users

You can have as many New Relic users as you require. Please contact us with the email addresses of any team members who need access to your New Relic monitoring.

The VIP team may use New Relic to perform various analyses or investigations on your behalf (such as in support of a ticket you opened, or to investigate a possible issue raised by our site monitoring) on all the sites and applications on the VIP Go platform; therefore we require that your application uses the WordPress.com VIP New Relic account, rather than your own New Relic account, in order for us to continue doing so.

Note

It is your responsibility to request that leaving members of your teams have their New Relic access removed.

Enabling New Relic Browser Monitoring

To enable New Relic on VIP Go for the first time, please create a support ticket and we’ll activate it for you.

To disable Browser Monitoring any time, you can use the newrelic_disable_autorum() function:

if ( function_exists( 'newrelic_disable_autorum' ) ) {
    newrelic_disable_autorum();
}

New Relic PHP API and SDK

New Relic maintains a suite of PHP functions which can be used to add data to transactions, name transactions, etc. You can read more in their documentation. WordPress.com VIP uses this API to enhance the data provided by all VIP Go WordPress applications (see the code).

We don’t offer custom PHP INI configuration for individual WordPress applications (sites), but you may find that some of the configuration can be set in PHP at runtime using ini_set().

Separating apps out on a per-site basis for multisite

For a site-per-app basis, you can use newrelic_set_appname() in vip-config.php or client-mu-plugins:

if ( extension_loaded( 'newrelic' ) && defined( 'VIP_GO_ENV' ) && 'production' === VIP_GO_ENV ) {
	newrelic_set_appname( $_SERVER['HTTP_HOST'] );
}

Depending on how your multisite structure is set up, you may need to set the application name accordingly (e.g. to account for paths in the application name if the sites share the same host domain). For example, if site 2 is https://example.com/foo and site 3 is https://example.com/bar), you’d want to distinguish between them (this code should go into a file in client-mu-plugins, and not in vip-config.php):

add_action( 'init', 'my_new_relic_appname', -1 );
/**
 * Set application name for New Relic.
 *
 * This is because we want to keep the main site appname the same as before so all data/reports are in the same place.
 *
 * Ensure PHP agent is available and only when not the main site. 
 */
function my_new_relic_appname() {
	if ( extension_loaded( 'newrelic' ) &&
		defined( 'VIP_GO_ENV' ) &&
		'production' === VIP_GO_ENV &&
		! is_main_site()
	) {
		$parsed_site_url = wp_parse_url( site_url() );
		$path            = $parsed_site_url['path'] ?? '';
		newrelic_set_appname( $_SERVER['HTTP_HOST'] . $path );
	}
}

Further reading

For further information about New Relic, we recommend exploring their documentation:

General New Relic documentation

Some specific picks from the New Relic documentation which might be of particular interest:

Last updated: April 09, 2021