ersoy-insider/ newrelic-custom-event
向 NewRelic Insights 发送自定义事件
1.0.2
2018-03-04 09:52 UTC
Requires
- php: >=7.0.0
- illuminate/config: ~5.3|~5.4|~5.5
- illuminate/events: ~5.3|~5.4|~5.5
- illuminate/queue: ~5.3|~5.4|~5.5
- illuminate/support: ~5.3|~5.4|~5.5
- ixudra/curl: ^6.16
Requires (Dev)
- laravel/lumen-framework: ^5.5
- mockery/mockery: ^1.0
- phpunit/phpunit: ^6
This package is not auto-updated.
Last update: 2024-09-20 02:18:34 UTC
README
一个简单的库,用于向 NewRelic Insights 发送自定义事件
Lumen 安装
使用 Composer 安装此包
$ composer require ersoy-insider/newrelic-custom-event
或 composer.json
"require": { "ersoy-insider/newrelic-custom-event": "^1.0" },
配置
添加服务提供者
$app->register(\ErsoyInsider\NewrelicCustomEvent\NewRelicCustomEventServiceProvider::class);
如果想要使用外观,请添加以下行
$app->withFacades(true, [ '\ErsoyInsider\NewrelicCustomEvent\Facades\NewRelicDispatcher' => 'NewRelicDispatcher' ]);
将 /vendor/ersoy-insider/newrelic-custom-event/config/new-relic-custom-event.php 文件复制到您的本地配置目录。编辑 config/new-relic-custom-event.php 以设置您的 NewRelic 凭据。
基本用法
app('new-relic-dispatcher')->fire($properties);
或
\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是基本键值数组。- 只有
users键的值允许为数组,其他键的值将被丢弃,因为违反了 NewRelic 的政策。 - 事件将被排队,以便发送到 NewRelic 的 Insights。