tarjei / statsdbundle
通过statsd发送统计信息到graphite的包
dev-master
2012-10-08 18:21 UTC
Requires
- php: >=5.3.2
- symfony/framework-bundle: 2.*
This package is not auto-updated.
Last update: 2020-01-01 18:01:52 UTC
README
StatsDBundle
这是一个简单的包,可以创建一个statsd服务,您可以使用它通过statsd将计数器发送到graphite。
它基于statd包中找到的示例statsd客户端:https://github.com/etsy/statsd
Statsd
Statsd是一个用于聚合统计信息(计数器和计时器)、汇总并随后将它们发送到[graphite][graphite]的网络守护进程。
([Etsy][etsy]) [博客文章][博客文章]介绍了其工作原理以及为何创建它
安装
添加到依赖中
[SMStatsDBundle] git=git://github.com:tarjei/StatsDBundle.git target=/bundles/SM/StatsDBundle
然后注册包到您的内核
// app/AppKernel.php // in AppKernel::registerBundles() $bundles = array( // ... new SM\StatsDBundle\SMStatsDBundle(), // ... );
确保您还注册了命名空间到自动加载器
// app/autoload.php $loader->registerNamespaces(array( // ... 'SM\\StatsDBundle' => __DIR__ . '/../vendor/bundles', ));
配置
插件期望statsd本地运行
在您的生产/开发环境中
# app/config/config.yml statsd: host: port:
默认值
statsd: host: localhost port: 8125 noop: false
如果没有启用,则no-op选项表示客户端被调用,但不发送信号或连接到statsd。
使用方法
示例用法
// MyController.com $stats = $this->get('statsd'); $stats->increment("users"); $stats->timing("querytime", $time)
更多信息请参阅StatsD.php文件。
待办事项
- 将日志服务添加到其中
- 考虑如何处理空统计信息
- 更好的示例
贡献者
由于没有贡献者列表,请查看项目的提交历史记录。
[graphite]: http://graphite.wikidot.com [etsy]: http://www.etsy.com [博客文章]: http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/ [node]: https://node.org.cn [udp]: http://enwp.org/udp