All Projects → digiaonline → lumen-newrelic

digiaonline / lumen-newrelic

Licence: MIT license
New Relic instrumentation for the Lumen framework

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to lumen-newrelic

php7-alpine
Docker container for PHP 7 in Alpine Linux, with almost all extensions that you may need
Stars: ✭ 20 (-23.08%)
Mutual labels:  lumen, newrelic
lumen-realworld-example-app
Exemplary real world backend API built with Lumen + MongoDB
Stars: ✭ 50 (+92.31%)
Mutual labels:  lumen
nrjmx
Command line tool to connect to a JMX server and retrieve the MBeans it exposes.
Stars: ✭ 28 (+7.69%)
Mutual labels:  newrelic
cache
Laravel & Lumen Cache Service | File and Redis cache system
Stars: ✭ 19 (-26.92%)
Mutual labels:  lumen
apollo-newrelic-extension
Apollo Server extension library for performing NewRelic transaction traces of graphql requests
Stars: ✭ 16 (-38.46%)
Mutual labels:  newrelic
Laravel-FluentLogger
fluent logger for laravel (with Monolog handler for Fluentd)
Stars: ✭ 55 (+111.54%)
Mutual labels:  lumen
Lumen
An alternative BEAM implementation, designed for WebAssembly
Stars: ✭ 2,742 (+10446.15%)
Mutual labels:  lumen
nippo
本アプリケーションはYAPC::Hokkaido 2016の「Vue.jsによるWebアプリケーション開発」用に実装したサンプルアプリケーションです。
Stars: ✭ 17 (-34.62%)
Mutual labels:  lumen
lumen-session-example
Enable session in lumen framework (Laravel)
Stars: ✭ 22 (-15.38%)
Mutual labels:  lumen
signature
HMAC and RSA signature for Laravel and Lumen
Stars: ✭ 26 (+0%)
Mutual labels:  lumen
paper-wallet
stellar.github.io/paper-wallet/
Stars: ✭ 41 (+57.69%)
Mutual labels:  lumen
laravel-redis-sentinel-drivers
Redis Sentinel integration for Laravel and Lumen.
Stars: ✭ 100 (+284.62%)
Mutual labels:  lumen
nrql-simple
nrql-simple provides a convenient way to interact with the New Relic Insights query API.
Stars: ✭ 13 (-50%)
Mutual labels:  newrelic
qiniu-laravel-storage
Qiniu 云储存 Laravel 5 Storage版
Stars: ✭ 520 (+1900%)
Mutual labels:  lumen
entrust
This package is based on Zizaco/entrust to support Laravel/Lumen 6+ versions
Stars: ✭ 22 (-15.38%)
Mutual labels:  lumen
Laravel Log Viewer
🐪 Laravel log viewer
Stars: ✭ 2,726 (+10384.62%)
Mutual labels:  lumen
k8s-webhook-cert-manager
Generate certificate suitable for use with any Kubernetes Mutating Webhook.
Stars: ✭ 59 (+126.92%)
Mutual labels:  newrelic
benotes
An open source self hosted notes and bookmarks taking web app.
Stars: ✭ 260 (+900%)
Mutual labels:  lumen
inspector-laravel
Connect your Laravel application to Inspector.
Stars: ✭ 164 (+530.77%)
Mutual labels:  lumen
laravel-snowflake
This Laravel package to generate 64 bit identifier like the snowflake within Twitter.
Stars: ✭ 94 (+261.54%)
Mutual labels:  lumen

lumen-newrelic

GitHub Actions status Scrutinizer Code Quality Coverage Status

This library provides New Relic instrumentation for the Lumen framework. When installed this library will ensure that your transactions are properly named and that your exceptions are properly logged in New Relic.

Requirements

Usage

Installation

Run the following command to install the package through Composer:

composer require nordsoftware/lumen-newrelic

Configuration

You don't have to set any config values if you are happy to rely on the content of your newrelic.ini file. However, it's possible to override the license and application name using environment variables or the .env file. This can be useful if you deploy the same app in multiple environments, and therefore need distinguished names for each.

Be aware that doing so can have a small performance impact on the app.

The environment variables available are:

  • NEW_RELIC_OVERRIDE_INI (defaults to false)
  • NEW_RELIC_APP_NAME
  • NEW_RELIC_LICENSE_KEY

If you don't set NEW_RELIC_OVERRIDE_INI to true, the app will not override the newrelic.ini file, regardless of the value of the other two variables.

Check out the description in /config/newRelic.php for an explanation of the effect.

Bootstrapping

In bootstrap/app.php, replace the $app->singleton() call which registers the exception handler with the following snippet:

$app->instance(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    new Nord\Lumen\ChainedExceptionHandler\ChainedExceptionHandler(
        new \App\Exceptions\Handler(),
        [new Nord\Lumen\NewRelic\NewRelicExceptionHandler()]
    )
);

This will ensure that exceptions are correctly reported to New Relic.

Now, add the middleware too:

$app->middleware([
	...
	Nord\Lumen\NewRelic\NewRelicMiddleware::class,
]);

This will ensure that transactions are named properly.

Finally, register the service provider:

$app->register(Nord\Lumen\NewRelic\NewRelicServiceProvider::class);

Ignoring certain exceptions

By default the exception handler ignores exceptions of type Symfony\Component\HttpKernel\Exception\NotFoundHttpException. You can customize the list of ignored exceptions by passing an array to the exception handler's constructor:

$exceptionHandler = new Nord\Lumen\NewRelic\NewRelicExceptionHandler([
	FooException::class,
	BarException::class,
]);

If you don't want any exception to be ignored, pass an empty array to the constructor.

Customizing transaction names

By default the transaction name will use the controller@action assigned to the route. If that fails, it will use the route's name. If no name is defined, it will fallback to just index.php.

If this doesn't meet your requirements, extend the Nord\Lumen\NewRelic\NewRelicMiddleware class and override the getTransactionName() method, then register that middleware class instead.

Marking transactions as background jobs

If you have a dedicated route for webhooks, notifications, or other long-running background tasks you can apply the Nord\Lumen\NewRelic\NewRelicBackgroundJobMiddleware to the route in question. This will mark the transaction as a background job in New Relic so that long processing times don't skew your response time graphs.

Running tests

Clone the project and install its dependencies by running:

composer install

Run the following command to run the test suite:

vendor/bin/phpunit

License

See LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].