kibatic/prometheus-metrics-builder
最新稳定版本:v1.0.1
Composer 安装命令:
composer require kibatic/prometheus-metrics-builder
包简介
Library that helps to build prometheus metrics
README 文档
README
This library helps you to build a Prometheus metrics endpoint for your PHP application.
Quick start
Install the library
composer require kibatic/prometheus-metrics-builder
Basic usage
$metricList = new MetricList(); $metricList->addMetric(new Metric('foo', 1)); $metricList->addMetric(new Metric('bar', "NaN")); $metricList->addMetric(new Metric( 'bar', 1.35, [ 'label1' => 'value1', 'label2' => 'value2', ] )); $response = $metricList->getResponseContent(); $metricList->clearMetrics();
The content of the response will be:
foo 1
bar NaN
bar{label1="value1",label2="value2"} 1.35
More advanced usage
attributes
$metric = new Metric( 'my_metric_name', 12, [ 'module' => 'invoice', 'instance' => 'value2', ], new \DateTimeImmutable() )
timestamp with miliseconds
$metric = new Metric( 'foo', 1, [], new \DateTimeImmutable('2020-01-01 00:00:00.012') );
For developpeurs
Run tests
# install all the needed dependencies make composer # run unit tests make test
Roadmap
- no plan for the moment
Versions
2022-11-21 : v1.0.1
- add CI with github actions
2022-11-21 : v1.0.0
- initial version
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-21