Skip to content

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

License

Notifications You must be signed in to change notification settings

TopShelfCraft/New-Relic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

New Relic

a plugin for Craft CMS

A Top Shelf Craft creation
Michael Rog, Proprietor

Instrument your Craft app with New Relic APM.


tl:dr

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

Installation

  1. From your project directory, use Composer to require the plugin package:

    composer require topshelfcraft/new-relic
    
  2. In the Control Panel, go to Settings → Plugins and click the “Install” button for New Relic.

  3. 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.

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.)

Support

What are the system requirements?

Craft 4.0+ and PHP 8.0+

I found a bug.

Suuuuure you did.

I triple-checked. It's a bug.

Well then, thanks for looking out for me. Please open a GitHub Issue or submit a PR to the 4.x.dev branch.


Contributors:

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published