memcrab/metrics
最新稳定版本:1.0.4
Composer 安装命令:
composer require memcrab/metrics
包简介
Coroutine-compatible metrics client for InfluxDB V2 (Telegraf listener input)
关键字:
README 文档
README
Memcrab Metrics is a library that provides an additional layer over the InfluxDB client to asynchronously send metrics to InfluxDB. It integrates with OpenSwoole for coroutine-based asynchronous operations and uses the InfluxDB line protocol for metric formatting.
Features
- Asynchronous metric sending with OpenSwoole coroutine support.
- Easy integration with InfluxDB client (version 3.1.0).
- Allows metrics to be sent in the InfluxDB line protocol format.
Installation
composer require memcrab/metrics
Usage
Initialize a client
You must call init() before sending any metrics. If you want to disable metric sending (e.g., in a LOCAL or test environment), pass false as the second argument.
$influxDBListenerUrl = 'http://127.0.0.1:8186/api/v2/write'; Metric::obj()->init($influxDBListenerUrl, ENVIRONMENT !== 'local');
Sending Metrics
Metric::obj()->write('cpu_usage', [ 'host' => 'server01' ], [ 'usage' => 45 ], time() );
License
The gem is available as open source under the terms of the MIT License.
统计信息
- 总下载量: 862
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-09