balt-technologies / newrelic-metrics
本包最新版本(0.1.0)没有提供许可证信息。
0.1.0
2020-12-18 12:08 UTC
README
安装
您可以使用composer安装php包。
composer require balt-technologies/newrelic-metrics
就是这样。
要求
您需要安装newrelic PHP扩展。
报告指标
$newRelic = new NewRelic();
$newRelic->report((new FormMetric())->created(1));
创建指标
use Balt\NewRelic\Metric;
class FormMetric implements Metric
{
private array $attributes;
public function __construct()
{
$this->attributes = [];
}
public function created(int $createdForms = 1): self
{
$this->attributes['created'] = $createdForms;
return $this;
}
public function getName(): string
{
return 'forms';
}
public function getAttributes(): array
{
return $this->attributes;
}
}