├── .env.dev ├── .gitignore ├── README.md ├── composer.json ├── dashboard.png └── src ├── Intouch └── LaravelNewrelic │ ├── Facades │ └── Newrelic.php │ ├── LumenNewrelicMiddleware.php │ ├── LumenNewrelicServiceProvider.php │ ├── NewrelicServiceProvider.php │ └── Observers │ ├── NewrelicCountingObserver.php │ └── NewrelicTimingObserver.php ├── config └── config.php └── lang └── .gitkeep /.env.dev: -------------------------------------------------------------------------------- 1 | NEWRELIC_AUTO_NAME_TRANSACTION=true 2 | NEWRELIC_NAME_PROVIDER={uri} {route} 3 | NEWRELIC_THROW_IF_NOT_INSTALLED=false 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.phar 3 | composer.lock 4 | .DS_Store 5 | /tests 6 | phpunit.xml 7 | .env 8 | .idea 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel 5 NewRelic Service Provider 2 | 3 | | Laravel Version | Package Tag | Supported | 4 | |-----------------|-------------|-----------| 5 | | 5.x.x | 2.2.x | yes | 6 | | 5.2.x | 2.1.x | yes | 7 | | 5.1.x | 2.0.x | yes | 8 | | 5.0.x | 2.0.x | no | 9 | 10 | *[see below for Laravel 4.x support](https://github.com/In-Touch/laravel-newrelic#laravel-4x-support)* 11 | 12 | ## Installation 13 | 14 | See the table above for package version information, and change the version below accordingly. 15 | 16 | Using `composer`, run: 17 | 18 | composer require intouch/laravel-newrelic:"~2.0" 19 | 20 | Or add `intouch/laravel-newrelic` to your composer requirements: 21 | 22 | "require": { 23 | "intouch/laravel-newrelic": "~2.0" 24 | } 25 | 26 | ... and then run `composer install` 27 | 28 | Once the package is installed, open your `config/app.php` configuration file and locate the `providers` key. Add 29 | the following line to the end: 30 | 31 | ```php 32 | Intouch\LaravelNewrelic\NewrelicServiceProvider::class, 33 | ``` 34 | 35 | Optionally, locate the `aliases` key and add the following line: 36 | 37 | ```php 38 | 'Newrelic' => Intouch\LaravelNewrelic\Facades\Newrelic::class, 39 | ``` 40 | 41 | Finally, publish the default configuration (it will end up in `config/newrelic.php`): 42 | 43 | php artisan vendor:publish --provider="Intouch\LaravelNewrelic\NewrelicServiceProvider" 44 | 45 | ## Configuration 46 | 47 | Once the configuration from the package if published, see `config/newrelic.php` for configuration options and 48 | descriptions. 49 | 50 | ## Transaction Names 51 | 52 | Naming is done by replacing tokens in a `name_provider` string with formatted output collected from the application. 53 | The `newrelic.name_provider` config parameter holds this string - note that non-token string parts are left as-is. 54 | 55 | | Token | Description | Example | 56 | |-------|-------------|---------| 57 | | {controller} | Controller / Action name | App\Http\Controllers\MyController@action | 58 | | {method} | HTTP Verb | GET, POST | 59 | | {route} | Route Name if named, otherwise {controller} | auth.login | 60 | | {path} | Registered route path | /users/{id?} | 61 | | {uri} | Request URI path | /users/12345 | 62 | 63 | The default `newrelic.name_provider` string is `'{uri} {route}'`. 64 | 65 | ## Eloquent Model Observers 66 | 67 | There are two observer classes for monitoring your Eloquent models, the `NewrelicCountingObserver` and the 68 | `NewrelicTimingObserver`. As their names suggest, one counts the number of times observable model events happen and the 69 | other gathers their timings (in milliseconds). These recorded metrics will show up in your NewRelic Custom Metrics. 70 | 71 | The `NewrelicCountingObserver` can be used for any observable model events, including your custom events. The 72 | `NewrelicTimingObserver` currently only supports the built-in Eloquent observable events (see 73 | [Model Events](https://laravel.com/docs/5.1/eloquent#events) in the Laravel documentation). 74 | 75 | Using the observers is simple - wherever you choose to register your model observers, simply add: 76 | 77 | ```php 78 | User::observe(new \Intouch\LaravelNewrelic\Observers\NewrelicTimingObserver() ); 79 | User::observe(new \Intouch\LaravelNewrelic\Observers\NewrelicCountingObserver() ); 80 | ``` 81 | 82 | ... assuming you want to observe the `User` model. 83 | 84 | Both observers take two optional parameters to their constructors: `$name` and `$care`. `$name` is the name you want 85 | to give to your custom metric, and if unset will default to the class name of the model object it is observing. If you 86 | want to change the `$care` array without changing the naming, simply pass `null` as the first constructor argument. 87 | 88 | `$care` is an array of event names you want to care about. This differs slightly between the *Counting* and 89 | *Timing* observers. For the *Counting* observer, any event can be counted independently. For the *Timing* 90 | observer, it uses the difference in time between `saving` and `saved` to submit the metric, so only the after-operation 91 | events can be observed: `created`, `saved`, `updated`, `deleted`, `restored`. This is also why custom observable events 92 | are not supported for the *Timing* observer (yet ... working on it, we're happy to take PRs). 93 | 94 | Per NewRelic's "best practice" suggestions, all metric names are prefaced with 'Custom/'. The *Counting* observer 95 | also adds 'Counts/' to the name, while the *Timing* observer adds 'Timing/' to the name. Both observers append 96 | the event name to the end of the metric name. Take as an example, using the *Counting* observer on the `User` model 97 | monitoring the `created` event - the name would be: `Custom/Counts/App/User/created` (where `App/User` is the namespaced 98 | class name of the observed model with slashes reversed for NewRelic metric paths, or will be whatever you set in `$name` 99 | if supplied). 100 | 101 | It is safe to run these observers in integration tests or interactive test environments as long as 102 | `newrelic.throw_if_not_installed` is set to `false`. Then if the NewRelic PHP Agent is not installed in that 103 | environment, the custom metrics will simply not be recorded. If the NewRelic PHP Agent is installed in that 104 | environment, the metrics will be recorded. 105 | 106 | The default events both observers care about are: `created`, `saved`, `updated`, `deleted`, `restored`. 107 | 108 | **NOTE:** To use the observers, the `Newrelic` Facade must be loaded in your application configuration, not just the 109 | Service Provider. 110 | 111 | **NOTE:** NewRelic restricts the total number of custom metrics you can have to 2000, and recommends less than 1000. 112 | 113 | #### Example Custom Metrics Dashboard 114 | ![dashboard](dashboard.png) 115 | 116 | ## Basic Use 117 | 118 | This package includes a Facade to the [Intouch/Newrelic](http://github.com/In-Touch/newrelic) class. 119 | Any of its methods may be accessed as any other Facade is accessed, for example: 120 | 121 | App::after( function() { 122 | Newrelic::setAppName( 'MyApp' ); 123 | } ); 124 | 125 | ... would set the NewRelic App Name to 'MyApp' 126 | 127 | ## Laravel 4.x Support 128 | 129 | | Laravel Version | Package Tag | Supported | 130 | |-----------------|-------------|-----------| 131 | | 4.2.x | [1.1.5](https://github.com/In-Touch/laravel-newrelic/tree/1.1.5) | no | 132 | | 4.1.x | [1.1.5](https://github.com/In-Touch/laravel-newrelic/tree/1.1.5) | no | 133 | | 4.0.x | [1.0.4](https://github.com/In-Touch/laravel-newrelic/tree/1.0.4) | no | 134 | *we will review PRs for unsupported versions, but we don't use those versions in production ourselves so we aren't 135 | testing / working on that* 136 | 137 | ## Issues 138 | 139 | Before opening an issues for data not reporting in the format you have configured, please check your NewRelic PHP Agent 140 | logs and please see: 141 | [https://discuss.newrelic.com/t/php-agent-4-19-0-disabled-3rd-party-service-provider-incorrectly/1666](https://discuss.newrelic.com/t/php-agent-4-19-0-disabled-3rd-party-service-provider-incorrectly/16667) 142 | 143 | If that hasn't cleared things up, please open an issue here or send us a PR. 144 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "intouch/laravel-newrelic", 3 | "type": "library", 4 | "keywords": ["newrelic", "new relic", "laravel"], 5 | "homepage": "https://github.com/In-Touch/laravel-newrelic", 6 | "license": "Apache 2.0", 7 | "description": "Laravel 5 NewRelic Integration", 8 | "authors": [ 9 | { 10 | "name": "Patrick Leckey", 11 | "email": "pleckey@intouchinsight.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.5.0", 16 | "illuminate/support": "5.*", 17 | "intouch/newrelic": ">=1.0.2" 18 | }, 19 | "require-dev": { 20 | }, 21 | "autoload": { 22 | "psr-0": { 23 | "Intouch\\LaravelNewrelic": "src/" 24 | } 25 | }, 26 | "minimum-stability": "dev" 27 | } 28 | -------------------------------------------------------------------------------- /dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/In-Touch/laravel-newrelic/18673d93ab6eaaedbe7804e7753b1113a437b094/dashboard.png -------------------------------------------------------------------------------- /src/Intouch/LaravelNewrelic/Facades/Newrelic.php: -------------------------------------------------------------------------------- 1 | get('newrelic.auto_name_transactions')) { 19 | app('newrelic')->nameTransaction($this->getTransactionName()); 20 | } 21 | $response = $next($request); 22 | 23 | return $response; 24 | } 25 | 26 | /** 27 | * Build the transaction name 28 | * 29 | * @return string 30 | */ 31 | public function getTransactionName() 32 | { 33 | return str_replace( 34 | [ 35 | '{controller}', 36 | '{method}', 37 | '{route}', 38 | '{path}', 39 | '{uri}', 40 | ], 41 | [ 42 | $this->getController(), 43 | app('request')->getMethod(), 44 | $this->getRoute(), 45 | app('request')->getPathInfo(), 46 | app('request')->getUri(), 47 | ], 48 | app('config')->get('newrelic.name_provider') 49 | ); 50 | } 51 | 52 | /** 53 | * Get the current route name, or controller if not named 54 | * 55 | * @return string 56 | */ 57 | protected function getRoute() 58 | { 59 | return $this->getRouteObject()['uri']; 60 | } 61 | 62 | /** 63 | * Get the current controller / action 64 | * 65 | * @return string 66 | */ 67 | protected function getController() 68 | { 69 | return isset($this->getRouteObject()['action']['uses']) ? $this->getRouteObject()['action']['uses'] : 'Closure'; 70 | } 71 | 72 | /** 73 | * Get current route object 74 | * @date 2016-02-10 75 | * @return array 76 | */ 77 | protected function getRouteObject() { 78 | $request = app('request'); 79 | 80 | $verbs = 'GET|POST|PUT|DELETE|PATCH'; 81 | 82 | $routeToRegex = function ($string) use ($verbs) { 83 | $string = preg_replace("/^({$verbs})/", '', $string); 84 | $string = preg_replace('/\{\w+\}/', '[^/]+', $string); 85 | $string = preg_replace('/\{(\w+):(.+?)\}/', '\2', $string); 86 | return '#^'.$string.'$#'; 87 | }; 88 | 89 | $routeToMethod = function ($string) use ($verbs) { 90 | return preg_replace("/^({$verbs}).+$/", '\1', $string); 91 | }; 92 | 93 | $routes = []; 94 | foreach (app()->getRoutes() as $routeName => $route) { 95 | $regex = $routeToRegex($routeName); 96 | $method = $routeToMethod($routeName); 97 | $routes[$method.$regex] = compact('route', 'method', 'regex'); 98 | } 99 | 100 | uksort($routes, function ($a, $b) { 101 | return strlen($b) - strlen($a); 102 | }); 103 | 104 | $method = $request->getMethod(); 105 | $path = rtrim($request->getPathInfo(), '/'); 106 | $foundRoute = null; 107 | 108 | foreach ($routes as $regex => $details) { 109 | $regex = substr($regex, strlen($details['method'])); 110 | if (true == preg_match($regex, $path) && $method == $details['method']) { 111 | $foundRoute = $details['route']; 112 | break; 113 | } 114 | } 115 | 116 | return $foundRoute; 117 | } 118 | } 119 | 120 | -------------------------------------------------------------------------------- /src/Intouch/LaravelNewrelic/LumenNewrelicServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->configure('newrelic'); 20 | $this->app->singleton( 21 | 'newrelic', 22 | function ( $app ) { 23 | return new Newrelic( $app['config']->get( 'newrelic.throw_if_not_installed' ) ); 24 | } 25 | ); 26 | 27 | app('queue')->before(function (JobProcessing $event) { 28 | app('newrelic')->backgroundJob( true ); 29 | app('newrelic')->startTransaction( ini_get('newrelic.appname') ); 30 | if (app('config')->get( 'newrelic.auto_name_jobs' )) { 31 | app('newrelic')->nameTransaction( $this->getJobName($event) ); 32 | } 33 | }); 34 | 35 | app('queue')->after(function (JobProcessed $event) { 36 | app('newrelic')->endTransaction(); 37 | }); 38 | } 39 | 40 | /** 41 | * Build the job name 42 | * 43 | * @return string 44 | */ 45 | public function getJobName(JobProcessing $event) 46 | { 47 | return str_replace( 48 | [ 49 | '{connection}', 50 | '{class}', 51 | ], 52 | [ 53 | $event->connectionName, 54 | $event->job->resolveName(), 55 | ], 56 | $this->app['config']->get( 'newrelic.job_name_provider' ) 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Intouch/LaravelNewrelic/NewrelicServiceProvider.php: -------------------------------------------------------------------------------- 1 | mergeConfigFrom( $config, 'newrelic' ); 44 | $this->publishes( [ $config => config_path( 'newrelic.php' ) ], 'config' ); 45 | 46 | $this->registerNamedTransactions(); 47 | $this->registerQueueTransactions(); 48 | } 49 | 50 | /** 51 | * Register the service provider. 52 | * 53 | * @return void 54 | */ 55 | public function register() 56 | { 57 | $this->app->singleton( 58 | 'newrelic', 59 | function ( $app ) { 60 | return new Newrelic( $app['config']->get( 'newrelic.throw_if_not_installed' ) ); 61 | } 62 | ); 63 | } 64 | 65 | /** 66 | * Get the services provided by the provider. 67 | * 68 | * @return array 69 | */ 70 | public function provides() 71 | { 72 | return [ 'newrelic' ]; 73 | } 74 | 75 | /** 76 | * Registers the named transactions with the NewRelic PHP agent 77 | */ 78 | protected function registerNamedTransactions() 79 | { 80 | $app = $this->app; 81 | 82 | if ($app['config']->get( 'newrelic.auto_name_transactions' )) { 83 | $app['events']->listen(RouteMatched::class, function (RouteMatched $routeMatched) use ( $app ) { 84 | $app['newrelic']->nameTransaction( $this->getTransactionName() ); 85 | }); 86 | } 87 | } 88 | 89 | /** 90 | * Registers the queue transactions with the NewRelic PHP agent 91 | */ 92 | protected function registerQueueTransactions() 93 | { 94 | $app = $this->app; 95 | 96 | $app['queue']->before(function (JobProcessing $event) use ( $app ) { 97 | $app['newrelic']->backgroundJob( true ); 98 | $app['newrelic']->startTransaction( ini_get('newrelic.appname') ); 99 | if ($app['config']->get( 'newrelic.auto_name_jobs' )) { 100 | $app['newrelic']->nameTransaction( $this->getJobName($event) ); 101 | } 102 | }); 103 | 104 | $app['queue']->after(function (JobProcessed $event) use ( $app ) { 105 | $app['newrelic']->endTransaction(); 106 | }); 107 | } 108 | 109 | /** 110 | * Build the transaction name 111 | * 112 | * @return string 113 | */ 114 | public function getTransactionName() 115 | { 116 | return str_replace( 117 | [ 118 | '{controller}', 119 | '{method}', 120 | '{route}', 121 | '{path}', 122 | '{uri}', 123 | ], 124 | [ 125 | $this->getController(), 126 | $this->getMethod(), 127 | $this->getRoute(), 128 | $this->getPath(), 129 | $this->getUri(), 130 | ], 131 | $this->app['config']->get( 'newrelic.name_provider' ) 132 | ); 133 | } 134 | 135 | /** 136 | * Build the job name 137 | * 138 | * @param JobProcessing $event 139 | * @return string 140 | */ 141 | public function getJobName(JobProcessing $event) 142 | { 143 | return str_replace( 144 | [ 145 | '{connection}', 146 | '{class}', 147 | ], 148 | [ 149 | $event->connectionName, 150 | $event->job->resolveName(), 151 | ], 152 | $this->app['config']->get( 'newrelic.job_name_provider' ) 153 | ); 154 | } 155 | 156 | /** 157 | * Get the request method 158 | * 159 | * @return string 160 | */ 161 | protected function getMethod() 162 | { 163 | return strtoupper( $this->app['router']->getCurrentRequest()->method() ); 164 | } 165 | 166 | /** 167 | * Get the request URI path 168 | * 169 | * @return string 170 | */ 171 | protected function getPath() 172 | { 173 | return ($this->app['router']->current()->uri() == '' ? '/' : $this->app['router']->current()->uri()); 174 | } 175 | 176 | protected function getUri() 177 | { 178 | return $this->app['router']->getCurrentRequest()->path(); 179 | } 180 | 181 | /** 182 | * Get the current controller / action 183 | * 184 | * @return string 185 | */ 186 | protected function getController() 187 | { 188 | $controller = $this->app['router']->current() ? $this->app['router']->current()->getActionName() : 'unknown'; 189 | if ($controller === 'Closure') { 190 | $controller .= '@' . $this->getPath(); 191 | } 192 | 193 | return $controller; 194 | } 195 | 196 | /** 197 | * Get the current route name, or controller if not named 198 | * 199 | * @return string 200 | */ 201 | protected function getRoute() 202 | { 203 | $name = $this->app['router']->currentRouteName(); 204 | if ( !$name ) 205 | { 206 | $name = $this->getController(); 207 | } 208 | 209 | return $name; 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/Intouch/LaravelNewrelic/Observers/NewrelicCountingObserver.php: -------------------------------------------------------------------------------- 1 | name = $name; 44 | $this->care = $care ?: $this->care; 45 | } 46 | 47 | /** 48 | * Handle the observable events we get passed 49 | * 50 | * @param string $event 51 | * @param array $args 52 | */ 53 | public function __call( $event, array $args ) 54 | { 55 | // ignore it if we don't care about this event 56 | if (!in_array( $event, $this->care )) { 57 | return; 58 | } 59 | 60 | $model = array_shift( $args ); 61 | $metric = trim( str_replace( '\\', '/', $this->name ?: get_class( $model ) ), '/' ); 62 | $name = 'Custom/Counts/' . $metric . '/' . $event; 63 | 64 | /** 65 | * NewRelic assumes custom metrics to be in milliseconds, so 4 gets interpreted as 66 | * .004. So each "count" increment is 1000 to display properly in custom dashboards. 67 | */ 68 | \Newrelic::customMetric( $name, 1000 ); 69 | } 70 | } -------------------------------------------------------------------------------- /src/Intouch/LaravelNewrelic/Observers/NewrelicTimingObserver.php: -------------------------------------------------------------------------------- 1 | name = $name; 64 | if (count( $care ) > 0) { 65 | $this->care = array_intersect( $this->valid, $care ); 66 | } 67 | } 68 | 69 | protected function getMetricName( $model, $event ) 70 | { 71 | return 'Custom/Timing/' . trim( str_replace( '\\', '/', $this->name ?: get_class( $model ) ), '/' ) . '/' . $event; 72 | } 73 | 74 | /** 75 | * Grab the time creating started 76 | * 77 | * @param Illuminate\Database\Eloquent\Model $model 78 | */ 79 | public function creating( $model ) 80 | { 81 | static::$times['create'] = -microtime( true ); 82 | } 83 | 84 | /** 85 | * Grab the time saving started 86 | * 87 | * @param Illuminate\Database\Eloquent\Model $model 88 | */ 89 | public function saving( $model ) 90 | { 91 | static::$times['save'] = -microtime( true ); 92 | } 93 | 94 | /** 95 | * Grab the time deleting started 96 | * 97 | * @param Illuminate\Database\Eloquent\Model $model 98 | */ 99 | public function deleting( $model ) 100 | { 101 | static::$times['delete'] = -microtime( true ); 102 | } 103 | 104 | /** 105 | * Grab the time updating started 106 | * 107 | * @param Illuminate\Database\Eloquent\Model $model 108 | */ 109 | public function updating( $model ) 110 | { 111 | static::$times['update'] = -microtime( true ); 112 | } 113 | 114 | /** 115 | * Grab the time restoring started 116 | * 117 | * @param Illuminate\Database\Eloquent\Model $model 118 | */ 119 | public function restoring( $model ) 120 | { 121 | static::$times['restore'] = -microtime( true ); 122 | } 123 | 124 | /** 125 | * Record the time it took to create 126 | * 127 | * @param Illuminate\Database\Eloquent\Model $model 128 | */ 129 | public function created( $model ) 130 | { 131 | if ( !in_array( 'created', $this->care ) ) return; 132 | $ms = round( static::$times['create'] + microtime( true ), 3 ) * 1000; 133 | \Newrelic::customMetric( $this->getMetricName( $model, 'created' ), $ms ); 134 | } 135 | 136 | /** 137 | * Record the time it took to save 138 | * 139 | * @param Illuminate\Database\Eloquent\Model $model 140 | */ 141 | public function saved( $model ) 142 | { 143 | if ( !in_array( 'saved', $this->care ) ) return; 144 | $ms = round( static::$times['save'] + microtime( true ), 3 ) * 1000; 145 | \Newrelic::customMetric( $this->getMetricName( $model, 'saved' ), $ms ); 146 | } 147 | 148 | /** 149 | * Record the time it took to delete 150 | * 151 | * @param Illuminate\Database\Eloquent\Model $model 152 | */ 153 | public function deleted( $model ) 154 | { 155 | if ( !in_array( 'deleted', $this->care ) ) return; 156 | $ms = round( static::$times['delete'] + microtime( true ), 3 ) * 1000; 157 | \Newrelic::customMetric( $this->getMetricName( $model, 'deleted' ), $ms ); 158 | } 159 | 160 | /** 161 | * Record the time it took to update 162 | * 163 | * @param Illuminate\Database\Eloquent\Model $model 164 | */ 165 | public function updated( $model ) 166 | { 167 | if ( !in_array( 'updated', $this->care ) ) return; 168 | $ms = round( static::$times['update'] + microtime( true ), 3 ) * 1000; 169 | \Newrelic::customMetric( $this->getMetricName( $model, 'updated' ), $ms ); 170 | } 171 | 172 | /** 173 | * Record the time it took to restore 174 | * 175 | * @param Illuminate\Database\Eloquent\Model $model 176 | */ 177 | public function restored( $model ) 178 | { 179 | if ( !in_array( 'restored', $this->care ) ) return; 180 | $ms = round( static::$times['restore'] + microtime( true ), 3 ) * 1000; 181 | \Newrelic::customMetric( $this->getMetricName( $model, 'restored' ), $ms ); 182 | } 183 | } -------------------------------------------------------------------------------- /src/config/config.php: -------------------------------------------------------------------------------- 1 | env('NEWRELIC_AUTO_NAME_TRANSACTION', true), 19 | 20 | /* 21 | * Will automatically name queued jobs in NewRelic, 22 | * using the Laravel job class, data, or connection name. 23 | * 24 | * Set this to false to use the NewRelic default naming 25 | * scheme, or to set your own in your application. 26 | */ 27 | 'auto_name_jobs' => env('NEWRELIC_AUTO_NAME_JOB', true), 28 | 29 | /* 30 | * Define the name used when automatically naming transactions. 31 | * a token string: 32 | * a pattern you define yourself, available tokens: 33 | * {controller} = Controller@action or Closure@path 34 | * {method} = GET / POST / etc. 35 | * {route} = route name if named, otherwise same as {controller} 36 | * {path} = the registered route path (includes variable names) 37 | * {uri} = the actual URI requested 38 | * anything that is not a matched token will remain a string literal 39 | * example: 40 | * "GET /world" with pattern 'hello {path} you really {method} me' would return: 41 | * 'hello /world you really GET me' 42 | */ 43 | 'name_provider' => env('NEWRELIC_NAME_PROVIDER', '{uri} {route}'), 44 | 45 | /* 46 | * Define the name used when automatically naming queued jobs. 47 | * a token string: 48 | * a pattern you define yourself, available tokens: 49 | * {connection} = The name of the queue connection 50 | * {class} = The name of the job class 51 | * anything that is not a matched token will remain a string literal 52 | * example: 53 | * Given a job named App\MyJob, with data {"subject":"hello","to":"world"}, 54 | * the pattern 'I say {input} when I run {class}' would return: 55 | * 'I say hello, world when I run App\MyJob' 56 | */ 57 | 'job_name_provider' => env('NEWRELIC_JOB_NAME_PROVIDER', '{class}'), 58 | 59 | /* 60 | * Will cause an exception to be thrown if the NewRelic 61 | * PHP agent is not found / installed 62 | */ 63 | 'throw_if_not_installed' => env('NEWRELIC_THROW_IF_NOT_INSTALLED', false), 64 | 65 | ); 66 | -------------------------------------------------------------------------------- /src/lang/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/In-Touch/laravel-newrelic/18673d93ab6eaaedbe7804e7753b1113a437b094/src/lang/.gitkeep --------------------------------------------------------------------------------