A Laravel package to monitor the status and history of jobs on the queue.

Overview

Monitored Jobs for Laravel

Overview

This package tracks the status and history of your queued jobs by hooking into the events that Laravel fires for its queue system.

We store this data in a database table, monitored_jobs.

Installation

composer require aryeo/monitored-jobs

Configuration

You can optionally publish the configuration file, which allows you to configure:

  • if monitoring is enabled
  • which jobs to monitor
  • the number of days to keep monitored job history before pruning

To publish the config file:

php artisan vendor:publish --tag=monitored-jobs

Controlling monitoring

To control whether any job is monitored, set the monitored-jobs.enabled configuration value.

There are two configuration options for filtering which jobs are monitored: include_jobs and exclude_jobs. The default value for both config options is null, which will include any job class.

  • 'include_jobs' => null means we are not setting the config option, so all jobs are monitored
  • 'include_jobs' => [] means we are setting the config option to include no jobs, meaning no jobs are monitored

Including and excluding the same job class

The exclude_jobs option will be checked first and will skip monitoring the job if it is found to be excluded.

Pruning Monitored Jobs

The MonitoredJob model is setup to use Laravel's model pruning: https://laravel.com/docs/8.x/eloquent#pruning-models.

In order for the models to be pruned, you must setup the command via the scheduler:

protected function schedule(Schedule $schedule)
{
    $schedule->command('model:prune')->daily();
}

You can adjust how long the monitored job records are kept for via the config file:

'prune_after_days' => 14,

Tags

The package will attempt to pull tags off of job classes. It does this by either using the tags method on the job class, or by pulling the arguments off of the job's constructor. When pulling the arguments off the constructor:

  • Models & collections of models will be serialized as {$class}_{$KEY}
  • Arrays will be JSON encoded
  • Booleans will be converted to "true" / "false" strings
  • Strings and numbers will be stored as-is
  • Objects will not be stored as tags
You might also like...
Make any class queue aware in a Laravel app
Make any class queue aware in a Laravel app

Make any class queue aware This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Support us We in

A wrapper for vladimir-yuldashev RabbitMQ Queue for Laravel with Actions

RabbitMQ Actions This package its a wrapper of vladimir-yuldashev/rabbitmq-queue-laravel. Adds a new feature to produce and consume messages with Rabb

Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

A Laravel chat package. You can use this package to create a chat/messaging Laravel application.
A Laravel chat package. You can use this package to create a chat/messaging Laravel application.

Chat Create a Chat application for your multiple Models Table of Contents Click to expand Introduction Installation Usage Adding the ability to partic

GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn
GeoLocation-Package - This package helps you to know the current language of the user, the country from which he is browsing, the currency of his country, and also whether he is using it vpn

GeoLocation in PHP (API) 😍 😍 😍 This package helps you to know a lot of information about the current user by his ip address 😍 😍 😍 This package h

This package provides extended support for our spatie/enum package in Laravel.
This package provides extended support for our spatie/enum package in Laravel.

Laravel support for spatie/enum This package provides extended support for our spatie/enum package in Laravel. Installation You can install the packag

Testbench Component is the de-facto package that has been designed to help you write tests for your Laravel package

Laravel Testing Helper for Packages Development Testbench Component is the de-facto package that has been designed to help you write tests for your La

🥳🔐 This package is a Laravel package that checks if an email address is a spammer
🥳🔐 This package is a Laravel package that checks if an email address is a spammer

This package is a Laravel package that checks if an email address is a spammer. It verifies your signups and form submissions to confirm that they are legitimate.

List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Comments
  • Track non overrided information in database

    Track non overrided information in database

    This is an idea for a potential enhancement, I could probably look at doing a PR but just wanted to get your thoughts.

    Currently columns like max_tries, max_exceptions, timeout, retry_until are all populated as null unless the value is overridden on the job class

    image

    i.e. the bottom job logs max_tries 1 as I have specified the tried property in the job class

    image

    Instead of populating null values throughout, could we not defer to the existing values in the queue.php or horizon.php files.

    queue.php could be used to derive the default retry_after values for the job

    image

    horizon.php could be used to derive the default tries, exceptions and timeout values

    image

    Obviously the default values would only populate in the table if they aren't overridden in the job class itself.

    This would allow users to see an historical log of where these default values may have changes, where currently they aren't visible.

    enhancement idea 
    opened by jamespavett 3
  • Change vendor file publish tag

    Change vendor file publish tag

    Currently the publish tag monitored-jobs doesn't actually allow any any of the vendor files to be copied. You have to run it with the config tag currently for it to publish the asset, which has the undesired side effect of also running any other package commands with the same identifier.

    image

    This change also keeps everything in line with the existing documentation, where it does suggest monitored-jobs should work.

    image

    released 
    opened by jamespavett 3
  • Unable to install on Laravel 9

    Unable to install on Laravel 9

    I am currently unable to install this package into my Laravel 9 project.

    image

    Tried clearing vendor folder etc... with no change. I just get the above error.

    I would have assumed the illuminate/support dependency is serviced by laravel/framework 9.5.1.

    Any help would be appreciated.

    opened by jamespavett 3
  • Ability to track Dispatchable or Queueable

    Ability to track Dispatchable or Queueable

    Think this would be like enhancement request, but do you think there is scope to extend this package to include the monitoring of other queueable or dispatchable tasks, such as Events?

    opened by jamespavett 1
Releases(v2.0.4)
Owner
Aryeo
The content platform of the real estate industry.
Aryeo
🍪 Laravel cookie consent history

?? Laravel cookie consent history This packages aims to make it easy to store anonymous cookie consents in a database in order to comply with rather s

Dystopia 3 Nov 9, 2022
Laravel package to periodically monitor the health of your server and application.

Laravel package to periodically monitor the health of your server and application. It ships with common checks out of the box and allows you to add your own custom checks too. The packages comes with both console and web interfaces.

Sarfraz Ahmed 170 Dec 13, 2022
This package allows you to easily track your laravel jobs!

Trackable Jobs For Laravel This package allows you to track your laravel jobs! Using this package, you can easily persist the output and the status of

Mateus Junges 220 Dec 25, 2022
This package tracks if products exist in Magento by storing the status locally in the DB.

Magento Products This package tracks if products exist in Magento by storing the status locally in the DB. We developed this to prevent multiple calls

JustBetter 14 Nov 11, 2022
Dispatch Laravel jobs via Artisan

This package can register jobs as Artisan commands. All you need to do is let your job implement the empty ArtisanDispatchable interface.

Spatie 135 Nov 7, 2022
Add variables to the payload of all jobs in a Laravel app

Inject extra info to the payloads of all jobs in a Laravel app This package makes it easy to inject things in every job. Imagine that you want to have

Spatie 62 Dec 9, 2022
Chain Laravel jobs without having to glue it to a starting job

Laravel Job Chainer JobChainer does chain a variable amount of jobs by adding them with the add() method. This makes it possible to chain jobs without

Just Iversen 69 Nov 18, 2022
This project is based on the aggregation of jobs from some technology companies.

FIND-JOBS-ALERT ?? ?? ?? This project is based on the aggregation of jobs from some technology companies. Check below, some companies avaliable in pro

Wellisson Ribeiro 2 Dec 1, 2021
A site which you can apply jobs or search for employees with cool functionalities..

About App An App which you can apply jobs or search for employees with cool functionalities. Some Pics of App Click Image to Zoom in Sign In & Up Empl

Fatih Canbolat 1 Jan 7, 2022
📛 An open source status page system for everyone.

Cachet is a beautiful and powerful open source status page system. Overview List your service components Report incidents Customise the look of your s

Cachet 13k Jan 4, 2023