mtxserv / metric-bundle
该包已被 弃用,不再维护。未建议替代包。
在您的 sf2 应用中添加 influxdb 度量指标
0.0.3
2016-01-22 15:00 UTC
Requires
- php: >=5.5
- corley/influxdb-sdk: ~0.9.2
- symfony/framework-bundle: ~2.3|~3.0
This package is not auto-updated.
Last update: 2022-02-01 12:55:01 UTC
README
一个简单易用的包,用于在您的 Symfony2 应用中添加 InfluxDB 度量指标。
安装
composer require mtxserv/metric-bundle
配置
添加到 config_prod.yml
metric:
host: %app_metric_host%
port: %app_metric_port% # UDP port
enable_collector: true # set true to collect data (request, execution time, memory, ..)
用法
$this->get('metric')->add('app_queue', [
'value' => 1,
]);
递增系列
$this->get('metric')->decrement('app_queue');
递减系列
$this->get('metric')->increment('app_queue');
计时系列
$this->get('metric')->timing('app_queue', time());
度量系列
$this->get('metric')->measure('app_queue', 10.0);
添加标签
所有方法均支持添加标签的第三个参数。
示例
$this->get('metric')->add('app_queue', [
'value' => 1,
], [
'region' => 'eu',
]);
数据收集器
要启用数据收集器(在 kernel.terminate 事件上发送),将 enable_collector 标志设置为 true。
metric:
enable_collector: true # set true to collect data (request, execution time, memory, ..)