dev-master
9999999-dev https://github.com/sobit/insightsConvenient interface for using New Relic Insights
MIT
The Requires
- php >=5.4.0
- jms/serializer 0.16.*
- guzzlehttp/guzzle 4.0.*
by Sobit Akhmedov
new relic insights
Wallogit.com
2017 © Pedro Peláez
Convenient interface for using New Relic Insights
Convenient interface for using New Relic Insights., (*2)
Via Composer:, (*3)
``` json { "require": { "sobit/insights": "dev-master" } }, (*4)
## Usage ### 1. Creating your event Create your event which extends ```\Sobit\Insights\AbstractEvent``` class and set preferred event type. ``` php class MyEvent extends \Sobit\Insights\AbstractEvent { public function getEventType() { return 'SomeEvent'; } }
Populate this class with attributes you want to be submitted to Insights:, (*5)
``` php class MyEvent extends Sobit\Insights\AbstractEvent { private $myAttribute;, (*6)
public function __construct($myAttribute)
{
$this->myAttribute = $myAttribute;
}
public function getEventType()
{
return 'SomeEvent';
}
}, (*7)
### 2. Submitting events ``` php 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();
The MIT License (MIT). Please see License File for more information., (*8)
Convenient interface for using New Relic Insights
MIT
new relic insights