a plugin for Craft CMS
A Top Shelf Craft creation
Michael Rog, Proprietor
Instrument your Craft app with New Relic APM.
This plugin helps connect your Craft app with New Relic APM by setting transaction names and (optionally) an app name on each request.
-
From your project directory, use Composer to require the plugin package:
composer require topshelfcraft/new-relic
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for New Relic.
-
Add a
new-relic.php
config file, edit the plugin Settings as needed.
The New Relic plugin is also available for installation via the Craft CMS Plugin Store.
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' => '',
];
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);
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.)
Craft 4.0+ and PHP 8.0+
Suuuuure you did.
Well then, thanks for looking out for me. Please open a GitHub Issue or submit a PR to the 4.x.dev
branch.
- Plugin development: Michael Rog / @michaelrog
- Craft 2 plugin: Josh Angel / @josh_angell
- Icon: New Relic