gustamms/prometheus-laravel
最新稳定版本:1.1.1
Composer 安装命令:
composer create-project gustamms/prometheus-laravel
包简介
Lib for prometheus connector
README 文档
README
To use
Run this command
composer require gustamms/prometheus-laravel
Copy the config/prometheus.php to your laravel/lumen implementation
https://github.com/gustamms/prometheus-laravel/blob/main/src/config/prometheus.php
In bootstrap/app.php add this configure
$app->configure('prometheus');
In bootstrap/app.php add this register provider
$app->register(\Gustamms\PrometheusLaravel\Providers\PrometheusServiceProvider::class);
In bootstrap/app.php add this middleware
$app->middleware([ ... \Gustamms\PrometheusLaravel\Middleware\PrometheusRouteMiddleware::class ]);
In .env add and change the values of this lines
PROMETHEUS_STORAGE_ADAPTER=redis PROMETHEUS_REDIS_HOST=localhost PROMETHEUS_REDIS_PORT=6379 PROMETHEUS_REDIS_TIMEOUT=0.1 PROMETHEUS_REDIS_READ_TIMEOUT=10 PROMETHEUS_REDIS_PERSISTENT_CONNECTIONS=0 PROMETHEUS_REDIS_PREFIX=PROMETHEUS_ PROMETHEUS_NAMESPACE=application_name
How use for personal metrics?
use Gustamms\PrometheusLaravel\PrometheusCollector; class DoSomething { private $collector; public function __construct() { $this->collector = new PrometheusCollector(); } public function do(){ $this->collector->getOrRegisterCounter( 'do_method_use', 'Pass in Do method' ); $this->collector->getOrRegisterHistogram( 'histogram_sample', 'Histogram are made', 1.2, ['label1'], ['labelvalue1'] ); } }
统计信息
- 总下载量: 101
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-04-29