PHPackages                             vntrungld/prometheus-exporter-horizon-collector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vntrungld/prometheus-exporter-horizon-collector

ActiveLibrary

vntrungld/prometheus-exporter-horizon-collector
===============================================

Horizon Collector for Prometheus Exporter

v1.2.0(3mo ago)03.0k↓50%MITPHPCI passing

Since Aug 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/vntrungld/prometheus-exporter-horizon-collector)[ Packagist](https://packagist.org/packages/vntrungld/prometheus-exporter-horizon-collector)[ Docs](https://github.com/vntrungld/prometheus-exporter-horizon-collector)[ RSS](/packages/vntrungld-prometheus-exporter-horizon-collector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

Prometheus Exporter Horizon Collector
=====================================

[](#prometheus-exporter-horizon-collector)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

A Laravel package that collects metrics from [Laravel Horizon](https://laravel.com/docs/horizon) and exposes them in Prometheus format. Works seamlessly with the [prometheus-exporter](https://github.com/vntrungld/prometheus-exporter) package.

Features
--------

[](#features)

- Automatic metric collection from Laravel Horizon
- 8 specialized collectors covering queue status, performance, and health
- Per-queue metrics with label-based differentiation
- Support for split queue configurations
- Graceful handling of empty data
- Zero configuration required

Requirements
------------

[](#requirements)

- PHP 7.4+
- Laravel 6.x, 7.x, 8.x, 9.x, 10.x, or 11.x
- Laravel Horizon 3.x, 4.x, or 5.x
- [vntrungld/prometheus-exporter](https://github.com/vntrungld/prometheus-exporter) ~1.0

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require vntrungld/prometheus-exporter-horizon-collector
```

The package will be auto-discovered by Laravel.

Configuration
-------------

[](#configuration)

Add the `HorizonCollectorSet` to your prometheus-exporter configuration:

```
// config/prometheus-exporter.php
'collector_sets' => [
    \Vntrungld\PrometheusExporterHorizonCollector\HorizonCollectorSet::class,
],
```

That's it! The metrics will now be available at your Prometheus exporter endpoint.

Available Metrics
-----------------

[](#available-metrics)

The package exposes 8 Prometheus gauge metrics:

### Queue Health Metrics

[](#queue-health-metrics)

MetricTypeLabelsDescription`horizon_status`Gauge-Horizon status: -1 (inactive), 0 (paused), 1 (running)`horizon_master_supervisors`Gauge-Number of active master supervisors### Queue Performance Metrics

[](#queue-performance-metrics)

MetricTypeLabelsDescription`horizon_current_processes`Gauge`queue`Number of worker processes per queue`horizon_current_workload`Gauge`queue`Current queue depth (pending jobs) per queue`horizon_current_wait`Gauge`queue`Current wait time in seconds per queue### Job Statistics Metrics

[](#job-statistics-metrics)

MetricTypeLabelsDescription`horizon_jobs_per_minute`Gauge-Jobs processed per minute (throughput)`horizon_recent_jobs`Gauge-Number of recently processed jobs`horizon_failed_jobs_per_hour`Gauge-Number of recently failed jobsExample Prometheus Output
-------------------------

[](#example-prometheus-output)

```
# HELP horizon_status The status of Horizon
# TYPE horizon_status gauge
horizon_status 1

# HELP horizon_master_supervisors The number of master supervisors
# TYPE horizon_master_supervisors gauge
horizon_master_supervisors 2

# HELP horizon_current_processes Current processes of all queues
# TYPE horizon_current_processes gauge
horizon_current_processes{queue="default"} 4
horizon_current_processes{queue="emails"} 2

# HELP horizon_current_workload Current workload of all queues
# TYPE horizon_current_workload gauge
horizon_current_workload{queue="default"} 150
horizon_current_workload{queue="emails"} 25

# HELP horizon_current_wait Current wait time of all queues
# TYPE horizon_current_wait gauge
horizon_current_wait{queue="default"} 5
horizon_current_wait{queue="emails"} 2

# HELP horizon_jobs_per_minute The number of jobs per minute
# TYPE horizon_jobs_per_minute gauge
horizon_jobs_per_minute 120

# HELP horizon_recent_jobs The number of recent jobs
# TYPE horizon_recent_jobs gauge
horizon_recent_jobs 5000

# HELP horizon_failed_jobs_per_hour The number of recently failed jobs
# TYPE horizon_failed_jobs_per_hour gauge
horizon_failed_jobs_per_hour 3

```

Horizon Status Values
---------------------

[](#horizon-status-values)

The `horizon_status` metric reports the overall health of Horizon:

ValueStatusDescription`1`RunningAll supervisors are running normally`0`PausedAt least one supervisor is paused`-1`InactiveNo master supervisors are runningArchitecture
------------

[](#architecture)

```
HorizonCollectorSet
├── CurrentMasterSupervisorCollector  → MasterSupervisorRepository
├── HorizonStatusCollector            → MasterSupervisorRepository
├── CurrentProcessesPerQueueCollector → WorkloadRepository
├── CurrentWorkloadCollector          → WorkloadRepository
├── CurrentWaitCollector              → WorkloadRepository
├── JobsPerMinuteCollector            → MetricsRepository
├── RecentJobsCollector               → JobRepository
└── FailedJobsPerHourCollector        → JobRepository

```

Each collector:

1. Implements the `Collector` interface
2. Receives dependencies via Laravel's service container
3. Queries Horizon repositories for data
4. Registers a Prometheus gauge metric

Example Grafana Queries
-----------------------

[](#example-grafana-queries)

### Queue Backlog Alert

[](#queue-backlog-alert)

```
horizon_current_workload{queue="default"} > 1000

```

### Processing Rate

[](#processing-rate)

```
rate(horizon_jobs_per_minute[5m])

```

### Failure Rate

[](#failure-rate)

```
horizon_failed_jobs_per_hour / horizon_recent_jobs * 100

```

### Wait Time by Queue

[](#wait-time-by-queue)

```
max(horizon_current_wait) by (queue)

```

### Horizon Health Check

[](#horizon-health-check)

```
horizon_status == 1

```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Or with PHPUnit directly:

```
./vendor/bin/phpunit
```

The package includes comprehensive tests:

- Unit tests for all 8 collectors
- Unit tests for the collector set
- Feature tests for service provider integration
- Integration tests for full collector lifecycle

Project Structure
-----------------

[](#project-structure)

```
src/
├── PrometheusExporterHorizonCollectorServiceProvider.php
├── HorizonCollectorSet.php
└── Collectors/
    ├── CurrentMasterSupervisorCollector.php
    ├── CurrentProcessesPerQueueCollector.php
    ├── CurrentWaitCollector.php
    ├── CurrentWorkloadCollector.php
    ├── FailedJobsPerHourCollector.php
    ├── HorizonStatusCollector.php
    ├── JobsPerMinuteCollector.php
    └── RecentJobsCollector.php

tests/
├── TestCase.php
├── Feature/
│   ├── CollectorIntegrationTest.php
│   └── ServiceProviderTest.php
└── Unit/
    ├── HorizonCollectorSetTest.php
    └── Collectors/
        └── [Individual collector tests]

```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Write tests for your changes
4. Ensure all tests pass (`composer test`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

- [Lam Duc Trung](https://github.com/vntrungld)

Related Packages
----------------

[](#related-packages)

- [vntrungld/prometheus-exporter](https://github.com/vntrungld/prometheus-exporter) - Base Prometheus exporter for Laravel
- [laravel/horizon](https://github.com/laravel/horizon) - Laravel Horizon queue monitoring

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance81

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~134 days

Total

6

Last Release

99d ago

Major Versions

v0.0.2 → v1.0.02024-12-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/39490e25f48deaf067db160681117abc2bdcf818fdce03a30eebc1ee25b784a0?d=identicon)[vntrungld](/maintainers/vntrungld)

---

Top Contributors

[![vntrungld](https://avatars.githubusercontent.com/u/19848743?v=4)](https://github.com/vntrungld "vntrungld (13 commits)")

---

Tags

laravelPrometheus ExporterHorizon Collector

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vntrungld-prometheus-exporter-horizon-collector/health.svg)

```
[![Health](https://phpackages.com/badges/vntrungld-prometheus-exporter-horizon-collector/health.svg)](https://phpackages.com/packages/vntrungld-prometheus-exporter-horizon-collector)
```

###  Alternatives

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[glhd/linen

21135.6k](/packages/glhd-linen)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
