This plugin helps connect your Craft app with New Relic APM by setting transaction names and (optionally) an app name on each request.

Configuration

You can use the Control Panel settings screen to configure the plugin, or add a new-relic.php file to your Craft config directory:

<?php
return [

    /*
     * Specify a different app name than
     * the one provided in your .ini files,
     * e.g. If you want to change the app name
     * on a per-environment basis...
     */
    'appName' => '',
    
    /*
     * Specify a string to override Segment 2
     * from the request path, e.g. If you want to
     * consolidate your reported routes...
     */
    'groupSegment2As' => '',

];

Enabling/Disabling for Testing

Leaving New Relic enabled when running test suites may cause problems — particularly when using CLI tools like Codeception — because Craft's isConsoleRequest() method may return erroneously when bootstrapped in a testing context.

To disable New Relic during testing, add the plugin handle to disabledPlugins, in the general.php config file in your Testing setup:

<?php
return [
    // ...
    
    'disabledPlugins' => [
        'new-relic',
    ],
    
    // ...
];

If you specifically need to use New Relic while running tests, you'll need to explicitly tweak the request in your test bootstrap:

Yii:$app->request->setIsConsoleRequest(Yii:$app->request instanceof yii/console/Request);

What is New Relic?

New Relic provides tools for real-time monitoring and performance insight. When every aspect of your software and infrastructure is observable, you can can find and fix problems faster. New Relic APM (Application Performance Monitoring) helps you build, deploy, and maintain great software by providing detailed performance metrics for every aspect of your environment.

This plugin assumes you already have an account set up at newrelic.com and that you have installed the APM tool in your environment.

(This plugin is an unofficial companion to your New Relic setup for Craft. New Relic APM is a trademark of New Relic, Inc.)

Installation Instructions

To install this plugin, copy the command above to your terminal.

Active Installs
115
Version
4.0.1
License
Craft
Compatibility
Craft 3, Craft 4
Last release
May 16, 2022
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs