sobit / insights
Convenient interface for using New Relic Insights
dev-master
2015-10-05 07:59 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: 4.0.*
- jms/serializer: 0.16.*
This package is not auto-updated.
Last update: 2024-12-31 03:36:48 UTC
README
Convenient interface for using New Relic Insights.
Install
Via Composer:
{ "require": { "sobit/insights": "dev-master" } }
Usage
1. Creating your event
Create your event which extends \Sobit\Insights\AbstractEvent
class and set preferred event type.
class MyEvent extends \Sobit\Insights\AbstractEvent { public function getEventType() { return 'SomeEvent'; } }
Populate this class with attributes you want to be submitted to Insights:
class MyEvent extends Sobit\Insights\AbstractEvent { private $myAttribute; public function __construct($myAttribute) { $this->myAttribute = $myAttribute; } public function getEventType() { return 'SomeEvent'; } }
2. Submitting events
use Sobit\Insights\Client\Client; use Sobit\Insights\EventManager; // configuration values as per New Relic Insights $accountId = 'YOUR ACCOUNT ID'; $insertKey = 'YOUR INSERT KEY'; $queryKey = 'YOUR QUERY KEY'; // initialize core classes $client = new Client(new GuzzleHttp\Client(), $accountId, $insertKey, $queryKey); $eventManager = new EventManager($client, JMS\Serializer\SerializerBuilder::create()->build()); // create your event $event = new MyEvent('some attribute'); // submit event to Insights $eventManager->persist($event); $eventManager->flush();
To do
- NRQL query builder
- Improve documentation
- Cover functionality with unit tests
License
The MIT License (MIT). Please see License File for more information.