Giter Club home page Giter Club logo

queue-stats's Introduction

Queue Stats

Adds commands to laravel to output information about running queue workers.

Configuration

Service Provider:

If you don't have auto discovery, register this provider in config/app.php:
\JrdnRc\QueueStats\QueueStatsServiceProvider::class

Configuration File

$ php artisan vendor:publish --provider="JrdnRc\\QueueStats\\QueueStatsServiceProvider"

<?php
    return [
        // ...
    
        /**
         * Define your workers here, including the redis connection,
         * the queues they are running, and how many
         * processes each worker should run
         */
        'queues' => [
            'default' => [
                'connection' => 'redis',
                'queue'      => ['default'],
                'processes'  => 1,
            ],
            
            'media-processing' => [
                'connection' => 'redis2',
                'queue'      => ['image-transforming', 'video-transforming'],
                'processes'  => 5,
            ],
        ],
    ];

Output:

$ php artisan queue:stats 
+--------------------+----------+-----------------------+---------+-----------+
| Queue              | In Queue | Reserved (Processing) | Delayed | Processes |
+--------------------+----------+-----------------------+---------+-----------+
| default            | 20       | 1                     | 0       | 1         |
| image-transforming | 0        | 0                     | 2       | 5         |
| video-transforming | 1        | 2                     | 0       | 5         |
+--------------------+----------+-----------------------+---------+-----------+
| Total:             | 21       | 0                     | 2       | 11        |
+--------------------+----------+-----------------------+---------+-----------+

Supervisor Config

This package can also generate supervisor config for your queue workers.

  • User is required
  • Log path and directory can be defined in config file
$ php artisan queue:supervisor --user=forge --log-path=/var/app/storage/logs --directory=/var/app 
[program:worker-default]
process_name=%(program_name)s_%(process_num)02d
directory=/var/app
command=php artisan queue:work --tries=1 --queue=default
autostart=true
autorestart=true
numprocs=1
username=forge
redirect_stderr=true
stdout_logfile=/var/app/storage/logs/default.log

[program:worker-media-processing]
process_name=%(program_name)s_%(process_num)02d
directory=/var/app
command=php artisan queue:work --tries=1 --queue=image-transforming,video-transforming
autostart=true
autorestart=true
numprocs=5
username=forge
redirect_stderr=true
stdout_logfile=/var/app/storage/logs/media-processing.log

queue-stats's People

Contributors

jrdnrc avatar agwidarsito avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.