2017 © Pedro Peláez
 

library newrelic

NewRelic module for Zend Framework

image

neeckeloo/newrelic

NewRelic module for Zend Framework

  • Thursday, December 15, 2016
  • by neeckeloo
  • Repository
  • 4 Watchers
  • 30 Stars
  • 105,275 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 8 Open issues
  • 14 Versions
  • 4 % Grown

The README.md

NewRelic module for Laminas

NewRelic module provide an object-oriented PHP wrapper for New Relic monitoring service., (*1)

Build Status Latest Stable Version Total Downloads, (*2)

Introduction

NewRelic module provide a logger and a wrapper for New Relic PHP API., (*3)

The current route is used to set the name of each transaction. Moreover, the module allow exceptions logging if enabled., (*4)

Requirements

  • PHP ^7.2
  • Laminas

Installation

NewRelic module only officially supports installation through Composer. For Composer documentation, please refer to getcomposer.org., (*5)

You can install the module from command line:, (*6)

$ composer require neeckeloo/newrelic

Alternatively, you can also add manually the dependency in your composer.json file:, (*7)

{
    "require": {
        "neeckeloo/newrelic": "^2.5"
    }
}

Enable the module by adding NewRelic key to your application.config.php file. Customize the module by copy-pasting the newrelic.global.php.dist file to your config/autoload folder., (*8)

Default configuration

return [
    'newrelic' => [
        // Sets the newrelic app name.  Note that this will discard metrics
        // collected before the name is set.  If empty then your php.ini
        // configuration will take precedence. You can set the value by
        // environment variable, or by overriding in a local config.
        'application_name' => getenv('NEW_RELIC_APP_NAME') ?: null,

        // May be null and will only be set if application name is also given.
        // You can set the value by environment variable, or by overriding in 
        // a local config.
        'license' => getenv('NEW_RELIC_LICENSE_KEY ') ?: null,

        // If false then neither change the auto_instrument or manually
        // instrument the real user monitoring.
        'browser_timing_enabled' => false,

        // When true tell the newrelic extension to insert Real User Monitoring
        // scripts automatically.
        'browser_timing_auto_instrument' => true,

        // When true, a logger with the newrelic writer will be called for
        // dispatch error events.
        'exceptions_logging_enabled' => false,

        // Defines ignored transactions
        'ignored_transactions' => [],

        // Defines background job transactions
        'background_jobs' => [],
    ],
];

Usage

Define transaction name

The module use NewRelic\Listener\RequestListener to specify the transaction name automatically using matched route name by default., (*9)

Transaction name providers

The transaction name is retrieved from a provider (NewRelic\TransactionNameProvider\RouteNameProvider by default) defined in the configuration., (*10)

use NewRelic\TransactionNameProvider\RouteNameProvider;

return [
    'newrelic' => [
        'transaction_name_provider' => RouteNameProvider::class,
    ],
];

The package contains some providers:, (*11)

  • RouteNameProvider
  • HttpRequestUrlProvider
  • NullProvider

Specify transaction name manually

You can also defined the transaction name yourself by defining NullProvider as transaction name provider and using nameTransaction method of the client., (*12)

Ignore transactions

NewRelic API allows to ignore some transactions. This configuration defines some routes and controllers of transactions that will be ignored., (*13)

Ignore routes

return [
    'newrelic' => [
        'ignored_transactions' => [
            'routes' => [
                'admin*',
                'user/login',
            ],
        ],
    ],
];

Those rules ignore all admin routes and the "user/login" route., (*14)

Ignore controllers

return [
    'newrelic' => [
        'ignored_transactions' => [
            'controllers' => [
                'FooController',
                'BarController',
                'BazController',
            ],
        ],
    ],
];

You can also ignore some actions of specified controllers :, (*15)

return [
    'newrelic' => [
        'ignored_transactions' => [
            'controllers' => [
                ['FooController', ['foo', 'bar']],
                ['BarController', ['baz']],
            ],
        ],
    ],
];

Ignore a transaction manually

You can ignore a transaction manually by calling ignoreTransaction() method of NewRelic client., (*16)

$client = $container->get('NewRelic\Client');
$client->ignoreTransaction();

Define background jobs

The configuration of background jobs is identical to ignored transactions but use the key background_jobs as below., (*17)

return [
    'newrelic' => [
        'background_jobs' => [],
    ],
];

Define a background job manually

You can define a transaction as background job manually by calling backgroundJob() method of NewRelic client., (*18)

$client = $container->get('NewRelic\Client');
$client->backgroundJob(true);

Ignore apdex metrics

You can ignore apdex metrics like transaction metrics using the key ignored_apdex., (*19)

return [
    'newrelic' => [
        'ignored_apdex' => [],
    ],
];

Ignore apdex metrics manually

You can ignore apdex metrics manually by calling ignoreApdex() method of NewRelic client., (*20)

$client = $container->get('NewRelic\Client');
$client->ignoreApdex();

Add custom metric

$client = $container->get('NewRelic\Client');
$client->addCustomMetric('salesprice', $price);

The Versions

24/01 2014

v1.1.4

1.1.4.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

23/01 2014

v1.1.3

1.1.3.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

23/01 2014

v1.1.2

1.1.2.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

22/01 2014

v1.1.1

1.1.1.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

22/01 2014

v1.1.0

1.1.0.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

20/01 2014

v1.0.1

1.0.1.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic

22/10 2013

v1.0.0

1.0.0.0 https://github.com/neeckeloo/NewRelic

NewRelic for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 newrelic