承接 tech-djoin/laravel-prometheus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tech-djoin/laravel-prometheus

最新稳定版本:0.2.8

Composer 安装命令:

composer require tech-djoin/laravel-prometheus

包简介

README 文档

README

Latest Version on Packagist Total Downloads License: MIT

Laravel Prometheus is a package that allows you to integrate Prometheus, a popular open-source monitoring and alerting toolkit, into your Laravel applications. Prometheus is widely used for monitoring various aspects of software systems, including metrics, time series data, and alerting.

This package uses Redis to do the client side aggregation and also need installed phpredis extension for communication with the Redis key-value store. To install the phpredis extension you can follow link below:

https://github.com/phpredis/phpredis/blob/develop/INSTALL.md

Installation

You can install the package via composer:

composer require tech-djoin/laravel-prometheus

You can publish the config file with:

php artisan vendor:publish --provider="TechDjoin\LaravelPrometheus\PrometheusServiceProvider" --tag="config" 

Usage

This packages provides a middleware which can be added as a global middleware or as a single route.

// in `app/Http/Kernel.php`

protected $middleware = [
    // ...
    
    \TechDjoin\LaravelPrometheus\Middleware\MetricCollector::class
];
// in a routes file

Route::post('/dashboard', function () {
    //
})->middleware(\TechDjoin\LaravelPrometheus\Middleware\MetricCollector::class);

Exporting Metrics

This package adds a /metrics end-point, enabled by default, which exposes all metrics gathered by collectors.

If you would like to protect this end-point, you can add secret value on LARAVEL_PROMETHEUS_SECRET in your .env files, and you can only access the end-point using /metrics/{secret}

Testing

composer test

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributors

统计信息

  • 总下载量: 1.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-16