shazam/php-statsd
最新稳定版本:3.0.1
Composer 安装命令:
composer require shazam/php-statsd
包简介
Sends stats to Statsd.
关键字:
README 文档
README
Simple PHP library to send stats to statsd.
Installation
Add the dependency to your composer.json.
{ "require": { "shazam/php-statsd": "2.*" } }
Usage
An example of how to send metrics of how long it takes to load a page.
<?php use Statsd; // $config = array(...); // $path = ... // initialize client $configuration = new Statsd\Client\Configuration(); $configuration->setHost($config['host']) ->setNamespace($config['namespace']); $statsClient = new Statsd\Client($configuration); // add stats (you can also add an array of stats with addStats()) $statsClient->addStat( array( 'namespace' => 'endpoints.' . $path, // that will be your stat namespace 'value' => $executionTime, // calculate it in microseconds 'type' => 'ms' ) ); // send them $statsClient->sendStats();
You can use TIME_MS, COUNT, GAUGE or SET (ms, c, g, s) as type of stats.
Configuration
- A host to push metrics (use 127.0.0.1 if you have netpipes installed in your box).
- A port (by default, 8126).
- A namespace (where all your metrics will be added. Use "." to separate folders.
- Optionally, a Monolog\Logger object, to log the metrics.
An example of a config file for that client could be:
stats: enable: true client: host: 127.0.0.1 namespace: shazam.twitterhose
统计信息
- 总下载量: 3.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-04-24