anowarcst/prometheus-laravel-health-exporter

Laravel API性能健康监控的Prometheus导出器

v1.0.5 2020-04-10 10:04 UTC

This package is auto-updated.

Last update: 2024-09-10 20:20:05 UTC


README

这是一个非常简单的Prometheus导出器,支持Laravel 6.*和7.*。基本上是一个中间件,用于导出Laravel API的健康、状态和性能指标。

支持版本

  • Laravel 5.5-5.9, 6.* 和 7.*
  • PHP 5.6 - 7.4

预安装

  • Redis
  • Laravel

通过Composer安装

composer require anowarcst/prometheus-laravel-health-exporter

供应商发布

要发布配置文件

php artisan vendor:publish --provider="AnowarCST\PrometheusLaravelHealthExporter\LaravelRequestMonitoringServiceProvider"

如果你的Redis主机不是默认的,请更新你的.envprometheus_exporter.php中的Redis主机和端口

App\Http\Kernel.php中添加此中间件

protected $middleware = [
    ...
    \AnowarCST\PrometheusLaravelHealthExporter\Middleware\RequestExporter::class,
];

预览

php artisan serve

https://:8000/metrics

Prometheus

更新prometheus.yml

scrape_configs:
    - job_name: 'laravel'
        static_configs:
        - targets: ['localhost:8000']

重启你的Prometheus服务器。(如果你在不同的服务器上使用Prometheus,请更新localhost:8000

Grafana

Grafana仪表板