Description

WP New Relic (WPNR) is designed to use with New Relic APM which uses New Relic PHP Agent API to properly augment existing metrics with valuable WordPress details such as templates, users, request type, transaction names etc. This plugin is tested with PHP Agent 6.7.0.174.

New Relic is a trademark of New Relic, Inc.

Admin Settings

After activating the plugin, You will see a new option named New Relic under the Tools menu in your WordPress Dashboard. If you are running WordPress in Network Mode, the settings page will be found in your Network Dashboard.

Capture URL Parameters: If Capture URLs setting is enabled, it will capture URL parameters for displaying in transaction traces.

Basic Config

appname and capture_params config can be override using wp_nr_config filter. wp_nr_setup_config action hook can also be used to setup any extra config.

New Relic Custom Attributes

Certain useful custom attrribute (just like WordPress post meta) will be set for each event which can provide additional information using key-value pair. You can query events and filter them using these attributes in New Relic Insights. See NRQL reference for more details on how to query events.

User

User attribute is getting set using newrelic_set_user_attributes. If user is logged in, user ID will be set to user attribute and if not it will be set to not-logged-in.
Ex: In New Relic Insights you can query transactions for non-logged in users as
SELECT * FROM Transaction WHERE appName = ‘{appName}’ AND user = ‘not-logged-in’

Post ID

For single post, post ID will be set via post_id custom parameter in transaction.

There can be 3 type of requests namely web, ajax and cli. Current request type getting set as request_type custom parameter in transaction.
Request type can be override using wp_nr_request_type filter.

Using wp_nr_log_errors function, any plugin/theme can log errors/notices to New Relic for current transaction.
Note: This function can be used more than once but only last use will be considered to log the error to New Relic. It’s limitation of PHP Agent API.

wp_nr_log_errors( ‘Error message’, Exception $exception );

Runtime of async tasks

This plugin also tracks runtime of gearman async tasks. Gearman async task run for a particular hook and it’s runtime can be track using “wp_async_task-{hook}” custom attribute in New Relic Insights.

Issues

If you identify any errors or have an idea for improving the plugin, please open an issue. We’re excited to see what the community thinks of this project, and we would love your input!

FAQ

Reviews

I’m biased, since other members of my team built this, but using it for some clients I’m serving, I can say that the added data – particularly around the page template and user properties – saves significant time in diagnostics.