Posts Learn Components Snippets Categories Tags About
/

How to Record Laravel Horizon Metrics (Snapshot)

Learn how to get the metrics of Laravel Horizon by using the snapshot command

Created on Jul 28, 2021

23 views

Laravel Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues.

In the Horizon dashboard, there's a metrics dashboard and there you can see the graph of the ongoing "Jobs" and "Queues". In order to record/capture the ongoing queues that happen within your Laravel application, you can make use of the snapshot command.

To do that you have to run the "horizon:snapshot" command like below inside your console kernel class.
/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    $schedule->command('horizon:snapshot')->everyFiveMinutes();
}

Related Resource

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets

More