Posts Learn Components Snippets Categories Tags Tools 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

659 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

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

)