renoki-co / horizon-exporter
使用此 Prometheus 导出器导出 Laravel Horizon 指标。
2.0.0
2022-04-09 19:56 UTC
Requires
- php: ^8.0
- laravel/horizon: ^5.8
- renoki-co/laravel-exporter-contracts: ^2.0
Requires (Dev)
- mockery/mockery: ^1.5
- orchestra/testbench: ^7.0
- orchestra/testbench-core: ^7.0
- phpunit/phpunit: ^9.5.13
- predis/predis: ^1.1
This package is auto-updated.
Last update: 2024-08-25 11:58:47 UTC
README
使用此 Prometheus 导出器导出 Laravel Horizon 指标。此包利用了 Exporter Contracts。
🤝 支持
如果你在生产应用、演示、爱好项目、学校项目等中使用 Renoki Co. 的一个或多个开源包,请通过 Github Sponsors 赞助我们的工作。📦
🚀 安装
您可以通过 composer 安装此包
composer require renoki-co/horizon-exporter
发布配置
$ php artisan vendor:publish --provider="RenokiCo\HorizonExporter\HorizonExporterServiceProvider" --tag="config" $ php artisan vendor:publish --provider="RenokiCo\LaravelExporter\LaravelExporterServiceProvider" --tag="config"
🙌 使用
此包非常简单直观。安装后,它将在 /exporter/group/horizon-metrics
上注册路由,您可以将 Prometheus 指向它进行抓取。
请注意,指标不是按进程计算的,而是作为所有监督器的整体计算的。在水平扩展环境中,将 Prometheus 抓取器指向任意一个实例。
# HELP laravel_horizon_master_status That status of the Master Horizon process. 0 = inactive, 1 = paused, 2 = running.
# TYPE laravel_horizon_master_status gauge
laravel_horizon_master_status{name="master-1",pid="10082"} 2
# HELP laravel_horizon_queue_runtime Get total jobs runtime by queue.
# TYPE laravel_horizon_queue_runtime gauge
laravel_horizon_queue_runtime{queue="default"} 41.085
# HELP laravel_horizon_queue_throughput Get total jobs throughput by queue.
# TYPE laravel_horizon_queue_throughput gauge
laravel_horizon_queue_throughput{queue="default"} 4
# HELP laravel_horizon_job_runtime Get total workload runtime by job name.
# TYPE laravel_horizon_job_runtime gauge
laravel_horizon_job_runtime{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob"} 53.666666666667
laravel_horizon_job_runtime{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob2"} 3.34
# HELP laravel_horizon_job_throughput Get total workload throughput by job name.
# TYPE laravel_horizon_job_throughput gauge
laravel_horizon_job_throughput{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob"} 3
laravel_horizon_job_throughput{job="RenokiCo\\HorizonExporter\\Test\\Jobs\\BasicJob2"} 1
# HELP laravel_horizon_jobs_by_type Get total processed jobs into all queues by specific type (i.e. completed, pending, etc.).
# TYPE laravel_horizon_jobs_by_type gauge
laravel_horizon_jobs_by_type{type="completed"} 4
laravel_horizon_jobs_by_type{type="failed"} 1
laravel_horizon_jobs_by_type{type="pending"} 1
laravel_horizon_jobs_by_type{type="recent"} 6
laravel_horizon_jobs_by_type{type="recent_failed"} 1
# HELP php_info Information about the PHP environment.
# TYPE php_info gauge
php_info{version="8.0.10"} 1
🐛 测试
vendor/bin/phpunit
🤝 贡献
有关详细信息,请参阅 CONTRIBUTING。
🔒 安全
如果您发现任何与安全相关的问题,请通过电子邮件 alex@renoki.org 而不是使用问题跟踪器。