ersoy-insider / newrelic-custom-event by ersoy-insider

Sends custom events to newrelic insights
32,363
1
2
Package Data
Maintainer Username: ersoy-insider
Maintainer Contact: ersoy@useinsider.com (Ersoy Pembe)
Package Create Date: 2018-01-29
Package Last Update: 2018-03-04
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-18 15:16:48
Package Statistics
Total Downloads: 32,363
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Simple Library to send custom events to NewRelic Insights

Coverage Status Build Status StyleCI Scrutinizer Code Quality

Installation For Lumen

Require this package with Composer

$ composer require ersoy-insider/newrelic-custom-event

or composer.json

"require": {
  "ersoy-insider/newrelic-custom-event": "^1.0"
},

Configuration

Add service provider

$app->register(\ErsoyInsider\NewrelicCustomEvent\NewRelicCustomEventServiceProvider::class);

If you want to use facade, add following line

$app->withFacades(true, [
    '\ErsoyInsider\NewrelicCustomEvent\Facades\NewRelicDispatcher' => 'NewRelicDispatcher'
]);

Copy the /vendor/ersoy-insider/newrelic-custom-event/config/new-relic-custom-event.php file to your local config directory. Edit config/new-relic-custom-event.php for your NewRelic credentials.

Basic usage

app('new-relic-dispatcher')->fire($properties);

or

\NewRelicDispatcher::fire($properties);
$properties = [
    'jobName' => 'test',
    'users' => [
        ['id' => 5, 'name' => 'testasdada'],
        ['id' => 55, 'name' => 'test3'],
        ['id' => 555, 'name' => 'test2'],
        ['id' => 5555, 'name' => 'test4'],
    ],
    'test' => 'another-parameter',
    'yet-another' => 'parameter',
    'will-be' => ['discarded'] // it will be discarded
    'will-not-be' => 'discarded' // it will not be discarded
];
  • $properties is basic array consist of key values.
  • Only users key's value is allowed to array, any other key of which value is discarded because of NewRelic's policy.
  • Events will be queued for delivery to NewRelic's Insights.