Skip to content

Commit 817cb64

Browse files
committed
Apply formatting fixes to configure-horizon skill
1 parent d0a78fb commit 817cb64

File tree

5 files changed

+65
-52
lines changed

5 files changed

+65
-52
lines changed

resources/boost/skills/configure-horizon/SKILL.blade.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: configuring-horizon
3-
description: "Configures Laravel Horizon for Redis queue management. Triggered when a user mentions Horizon installation, queue supervisor setup, worker configuration, dashboard authorization, auto-scaling, job monitoring, metrics, tags, or notifications. Also applies when troubleshooting blank metrics, LongWaitDetected alerts, or misconfigured worker processes, even when Horizon is not named explicitly — applies to any request about queue workers backed by Redis with a monitoring dashboard, or monitoring Laravel jobs."
3+
description: "Configures Laravel Horizon for Redis queue management. Triggered when a user mentions Horizon installation, queue supervisor setup, worker configuration, dashboard authorization, auto-scaling, job monitoring, metrics, tags, or notifications. Also applies when troubleshooting blank metrics, LongWaitDetected alerts, or misconfigured worker processes, even when Horizon is not named explicitly. Applies to any request about queue workers backed by Redis with a monitoring dashboard, or monitoring Laravel jobs."
44
license: MIT
55
metadata:
66
author: laravel
@@ -23,14 +23,14 @@
2323

2424
## Documentation
2525

26-
Use `search-docs` for detailed Horizon patterns and documentation (configuration, supervisors, balancing, dashboard auth, tags, notifications, metrics, deployment).
26+
Use `search-docs` for detailed Horizon patterns and documentation covering configuration, supervisors, balancing, dashboard authorization, tags, notifications, metrics, and deployment.
2727

2828
For deeper guidance on specific topics, read the relevant reference file before implementing:
2929

30-
- `references/supervisors.md` supervisor blocks, balancing strategies, multi-queue setups, auto-scaling
31-
- `references/notifications.md` LongWaitDetected alerts, failed job notifications, `waits` config
32-
- `references/tags.md` job tagging, dashboard filtering, silencing noisy jobs
33-
- `references/metrics.md` blank metrics dashboard, snapshot scheduling, retention config
30+
- `references/supervisors.md` covers supervisor blocks, balancing strategies, multi-queue setups, and auto-scaling
31+
- `references/notifications.md` covers LongWaitDetected alerts, failed job notifications, and the `waits` config
32+
- `references/tags.md` covers job tagging, dashboard filtering, and silencing noisy jobs
33+
- `references/metrics.md` covers the blank metrics dashboard, snapshot scheduling, and retention config
3434

3535
## Basic Usage
3636

@@ -42,7 +42,7 @@
4242

4343
### Supervisor Configuration
4444

45-
Define supervisors in `config/horizon.php`. The `environments` array merges into `defaults` — it does not replace the whole supervisor block:
45+
Define supervisors in `config/horizon.php`. The `environments` array merges into `defaults` and does not replace the whole supervisor block:
4646

4747
@boostsnippet("Supervisor Config", "php")
4848
'defaults' => [
@@ -87,10 +87,10 @@ protected function gate(): void
8787

8888
## Common Pitfalls
8989

90-
- Horizon only works with the Redis queue driver — other drivers (database, SQS, etc.) are not supported
91-
- Redis Cluster is not supportedHorizon requires a standalone Redis connection
92-
- Always check `config/horizon.php` to understand the current supervisor and environment configuration before making changes
93-
- `environments` overrides only the keys you specify; it merges into `defaults`, it does not replace
94-
- Timeout chain must be ordered: `retry_after` < job `timeout` < supervisor `timeout`. Wrong order causes jobs to be force-killed and re-queued indefinitely
95-
- Metrics dashboard stays blank until `horizon:snapshot` is scheduled `php artisan horizon` alone does not populate metrics
96-
- Not using `search-docs` for the latest Horizon documentation
90+
- Horizon only works with the Redis queue driver. Other drivers such as database and SQS are not supported.
91+
- Redis Cluster is not supported. Horizon requires a standalone Redis connection.
92+
- Always check `config/horizon.php` before making changes to understand the current supervisor and environment configuration.
93+
- The `environments` array overrides only the keys you specify. It merges into `defaults` and does not replace it.
94+
- The timeout chain must be ordered: `retry_after` less than job `timeout` less than supervisor `timeout`. The wrong order causes jobs to be force-killed and re-queued indefinitely.
95+
- The metrics dashboard stays blank until `horizon:snapshot` is scheduled. Running `php artisan horizon` alone does not populate metrics.
96+
- Always use `search-docs` for the latest Horizon documentation rather than relying on this skill alone.

resources/boost/skills/configure-horizon/references/metrics.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
## Where to Find It
44

55
Search with `search-docs`:
6-
- `"horizon metrics snapshot"` snapshot command and scheduling
7-
- `"horizon trim snapshots"` retention configuration
6+
- `"horizon metrics snapshot"` for the snapshot command and scheduling
7+
- `"horizon trim snapshots"` for retention configuration
88

99
## What to Watch For
1010

11-
**The metrics dashboard is blank until `horizon:snapshot` has run at least once.**
12-
Running `php artisan horizon` does not populate metrics automatically. The metrics graph is built from snapshots — you must schedule `php artisan horizon:snapshot` to run every 5 minutes via Laravel's scheduler. If the dashboard is blank, this is almost always the reason.
11+
### Metrics dashboard stays blank until `horizon:snapshot` is scheduled
1312

14-
**Register the snapshot in the scheduler, not just once manually.**
15-
A single manual run populates the dashboard momentarily but won't keep it updated. Search `"horizon metrics snapshot"` for the exact scheduler registration syntax — it differs slightly between Laravel 10 and 11+.
13+
Running `php artisan horizon` does not populate metrics automatically. The metrics graph is built from snapshots, so `php artisan horizon:snapshot` must be scheduled to run every 5 minutes via Laravel's scheduler.
1614

17-
**`metrics.trim_snapshots` controls how many data points are retained — not a time duration.**
18-
The `trim_snapshots.job` and `trim_snapshots.queue` values in `config/horizon.php` are counts of snapshots to keep, not minutes or hours. With the default of 24 snapshots at 5-minute intervals, that's 2 hours of history. Increase the value to retain more history; the tradeoff is Redis memory usage.
15+
### Register the snapshot in the scheduler rather than running it manually
16+
17+
A single manual run populates the dashboard momentarily but will not keep it updated. Search `"horizon metrics snapshot"` for the exact scheduler registration syntax, which differs between Laravel 10 and 11+.
18+
19+
### `metrics.trim_snapshots` is a snapshot count, not a time duration
20+
21+
The `trim_snapshots.job` and `trim_snapshots.queue` values in `config/horizon.php` are counts of snapshots to keep, not minutes or hours. With the default of 24 snapshots at 5-minute intervals, that provides 2 hours of history. Increase the value to retain more history at the cost of Redis memory usage.

resources/boost/skills/configure-horizon/references/notifications.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
## Where to Find It
44

55
Search with `search-docs`:
6-
- `"horizon notifications"` listener registration and event list
7-
- `"horizon long wait detected"` LongWaitDetected event details
8-
- `"horizon failed job notification"` JobFailed listener example
6+
- `"horizon notifications"` for listener registration and the event list
7+
- `"horizon long wait detected"` for LongWaitDetected event details
8+
- `"horizon failed job notification"` for a JobFailed listener example
99

1010
## What to Watch For
1111

12-
**`waits` in `config/horizon.php` controls the LongWaitDetected threshold — not a notification setting.**
13-
The `waits` array (e.g., `'redis:default' => 60`) defines how many seconds a job can wait in a queue before Horizon fires a `LongWaitDetected` event. This is a config file value, not something set in the notification listener. If alerts are firing too often or too late, adjust `waits`, not the listener code.
12+
### `waits` in `config/horizon.php` controls the LongWaitDetected threshold, not the notification itself
1413

15-
**`LongWaitDetected` is an event — you must register a listener.**
16-
Horizon fires the event but doesn't send any notification by itself. You register a listener for `LongWaitDetected` (and optionally `JobFailed`) inside the `boot()` method of `App\Providers\HorizonServiceProvider`. The listener receives the event and is responsible for dispatching whatever notification (Mail, Slack, etc.) you want. Fetch the docs for the exact listener signature and example.
14+
The `waits` array (e.g., `'redis:default' => 60`) defines how many seconds a job can wait in a queue before Horizon fires a `LongWaitDetected` event. This value is set in the config file, not in the notification listener. If alerts are firing too often or too late, adjust `waits` rather than the listener code.
1715

18-
**Failed job notifications work differently from queue failures.**
19-
`LongWaitDetected` is about queue depth/wait time. Failed job notifications use the `JobFailed` event, which is also listened to in HorizonServiceProvider. These are two separate listeners with different event classes. Don't conflate them when setting up alerts.
16+
### `LongWaitDetected` fires an event that requires a registered listener to send notifications
17+
18+
Horizon fires the event but does not send any notification by itself. Register a listener for `LongWaitDetected` (and optionally `JobFailed`) inside the `boot()` method of `App\Providers\HorizonServiceProvider`. The listener receives the event and is responsible for dispatching the appropriate notification such as Mail or Slack. Fetch the docs for the exact listener signature and example.
19+
20+
### Failed job notifications use a separate event from LongWaitDetected
21+
22+
`LongWaitDetected` covers queue depth and wait time. Failed job notifications use the `JobFailed` event, which is also registered in HorizonServiceProvider. These are two separate listeners with different event classes.

resources/boost/skills/configure-horizon/references/supervisors.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22

33
## Where to Find It
44

5-
Search with `search-docs` before writing any supervisor config option names and defaults change between Horizon versions:
6-
- `"horizon supervisor configuration"` full options list
7-
- `"horizon balancing strategies"` auto, simple, and false modes
8-
- `"horizon autoscaling workers"` autoScalingStrategy details
9-
- `"horizon environment configuration"` defaults+environments merge
5+
Search with `search-docs` before writing any supervisor config, as option names and defaults change between Horizon versions:
6+
- `"horizon supervisor configuration"` for the full options list
7+
- `"horizon balancing strategies"` for auto, simple, and false modes
8+
- `"horizon autoscaling workers"` for autoScalingStrategy details
9+
- `"horizon environment configuration"` for the defaults and environments merge
1010

1111
## What to Watch For
1212

13-
**defaults + environments merge semantics.**
14-
The `defaults` array defines the complete base supervisor config. The `environments` array patches it per environment — only the keys you list are overridden. You do not need to repeat every key in each environment block. A common pattern: define `connection`, `queue`, `balance`, `autoScalingStrategy`, `tries`, and `timeout` in `defaults`; only override `maxProcesses`, `balanceMaxShift`, and `balanceCooldown` in `production`.
13+
### The `environments` array merges into `defaults` rather than replacing it
1514

16-
**Named supervisors = queue priority.**
17-
Horizon doesn't enforce queue order when using `balance: auto` on a single supervisor — the `queue` array order is ignored for load balancing. If you need true priority (process `notifications` before `default`), use two separately named supervisors: one for the high-priority queue with a higher `maxProcesses`, one for the low-priority queue with a lower cap. Fetch the docs — there's an explicit note about this.
15+
The `defaults` array defines the complete base supervisor config. The `environments` array patches it per environment, overriding only the keys listed. There is no need to repeat every key in each environment block. A common pattern is to define `connection`, `queue`, `balance`, `autoScalingStrategy`, `tries`, and `timeout` in `defaults`, then override only `maxProcesses`, `balanceMaxShift`, and `balanceCooldown` in `production`.
1816

19-
**`balance: false` for dedicated queues with fixed worker counts.**
20-
Auto-balancing is ideal for variable load, but if you have a queue that should always have exactly N workers (e.g., a video-processing queue limited to 2), set `balance: false` and `maxProcesses: 2`. Auto-balancing would scale it up during bursts, which you may not want.
17+
### Use separate named supervisors to enforce queue priority
2118

22-
**`balanceCooldown` prevents thrashing.**
23-
When using `balance: auto`, the supervisor can scale up and down rapidly under bursty load. Set `balanceCooldown` (seconds between scaling decisions) to something like 3–5 seconds to smooth this out. `balanceMaxShift` limits how many processes are added or removed per cycle.
19+
Horizon does not enforce queue order when using `balance: auto` on a single supervisor. The `queue` array order is ignored for load balancing. To process `notifications` before `default`, use two separately named supervisors: one for the high-priority queue with a higher `maxProcesses`, and one for the low-priority queue with a lower cap. The docs include an explicit note about this.
20+
21+
### Use `balance: false` to keep a fixed number of workers on a dedicated queue
22+
23+
Auto-balancing suits variable load, but if a queue should always have exactly N workers such as a video-processing queue limited to 2, set `balance: false` and `maxProcesses: 2`. Auto-balancing would scale it up during bursts, which may be undesirable.
24+
25+
### Set `balanceCooldown` to prevent rapid worker scaling under bursty load
26+
27+
When using `balance: auto`, the supervisor can scale up and down rapidly under bursty load. Set `balanceCooldown` to the number of seconds between scaling decisions, typically 3 to 5, to smooth this out. `balanceMaxShift` limits how many processes are added or removed per cycle.

resources/boost/skills/configure-horizon/references/tags.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
## Where to Find It
44

55
Search with `search-docs`:
6-
- `"horizon tags"` tagging API and auto-tagging behaviour
7-
- `"horizon silenced jobs"` silenced/silenced_tags config options
6+
- `"horizon tags"` for the tagging API and auto-tagging behaviour
7+
- `"horizon silenced jobs"` for the `silenced` and `silenced_tags` config options
88

99
## What to Watch For
1010

11-
**Eloquent models are auto-tagged — you often don't need to add tags manually.**
12-
If a job's constructor accepts Eloquent model instances, Horizon automatically tags the job with `ModelClass:id` (e.g., `App\Models\User:42`). You can filter by this tag in the dashboard without any code changes to the job. Only add a `tags()` method when you need custom tags beyond what auto-tagging provides.
11+
### Eloquent model jobs are tagged automatically without any extra code
1312

14-
**`silenced` hides jobs from the completed list — it does not stop them from running.**
15-
Adding a job class to the `silenced` array in `config/horizon.php` removes it from the dashboard's completed jobs view. The job still runs normally. This is purely a dashboard noise-reduction tool, not a way to disable jobs.
13+
If a job's constructor accepts Eloquent model instances, Horizon automatically tags the job with `ModelClass:id` such as `App\Models\User:42`. These tags are filterable in the dashboard without any changes to the job class. Only add a `tags()` method when custom tags beyond auto-tagging are needed.
1614

17-
**`silenced_tags` works the same way but matches by tag.**
18-
Any job carrying a matching tag string is hidden from completed jobs. Useful when you want to silence a category of jobs (e.g., all jobs tagged `notifications`) rather than specific classes.
15+
### `silenced` hides jobs from the dashboard completed list but does not stop them from running
16+
17+
Adding a job class to the `silenced` array in `config/horizon.php` removes it from the completed jobs view. The job still runs normally. This is a dashboard noise-reduction tool, not a way to disable jobs.
18+
19+
### `silenced_tags` hides all jobs carrying a matching tag from the completed list
20+
21+
Any job carrying a matching tag string is hidden from the completed jobs view. This is useful for silencing a category of jobs such as all jobs tagged `notifications`, rather than silencing specific classes.

0 commit comments

Comments
 (0)