Queue Worker Monitoring

Queue worker monitoring for Sidekiq, Celery, BullMQ, RQ and Laravel

A queue worker stops in one of three ways: the process dies, it stays up but takes no jobs, or it takes jobs and they fail. A heartbeat job that has to pass through each queue on a schedule catches the first two. Start and finish pings around every job catch the third.

50 monitors freeNo SDK or agentOutbound HTTPS only

Seven ways a queue stops working, and the signal that catches each

Queue worker monitoring comes down to three questions: is anything taking jobs (liveness), did each job finish (outcome), and how long do jobs wait (backlog). No single signal answers all three, and the seven failures below need different ones.

Queue worker failures, how each looks from outside, the signal that catches it and the matching Drumbeats monitor
What goes wrongWhat it looks like from outsideSignal that catches itIn Drumbeats
No worker is running for the queueA crash, an OOM kill, a deploy that did not bring the worker back, or autoscaling to zero. Producers keep enqueueing without an error and the queue grows.Liveness: a heartbeat job scheduled on that queue stops arriving.A heartbeat monitor opens a MISSED incident when the interval plus the grace period passes with no ping.
A worker is running but takes no jobsThe broker connection is gone, or every thread is blocked on a call that has no timeout. The process is up and may still be listed as a worker.Liveness: the same heartbeat job. It cannot pass through a worker that takes nothing.The same heartbeat monitor and the same MISSED incident.
A worker dies in the middle of a jobIt depends on the framework: the job is lost, run again after a delay, or marked failed later. The notes per framework below say which.Job outcome: a start ping that is never followed by a finish ping.An event-driven monitor with max_duration_seconds records the run as FAILED once the limit passes.
A job raises, or runs out of retriesThe job waits in a retry set, a dead set or a failed-jobs table until someone opens the dashboard.Job outcome: a failure ping from the hook that wraps every job.The event-driven monitor of that job class goes down after failure_tolerance failures in a row. The default is 1.
The scheduler stops enqueueingCelery beat is down, a BullMQ job scheduler is gone from Redis, or cron no longer fires. The queue is empty, the workers are idle and every chart looks healthy.Liveness of the schedule: a scheduled job does not report on time.The heartbeat job is itself scheduled, so it goes missing with the schedule. A named scheduled job gets its own cron monitor.
Workers are slower than producersJobs still finish, only later. Queue depth and the age of the oldest job climb.Backlog: queue latency or depth, read from the broker.Not a ping. Alert on it from your metrics stack, or point an uptime monitor at an endpoint that returns a non-2xx status above your threshold.
A job finishes without doing its workAn empty query result or an early return. Every dashboard counts the job as a success.Job outcome, plus a floor on how long a real run takes.With min_duration_seconds set, a run that finishes faster opens a DURATION_LOW warning.

The first, second and fifth rows only show up as silence, and a heartbeat is an alert raised by a ping that did not arrive. The third, fourth and seventh are about single runs, so they need a ping per job. The sixth is a measurement, and a ping is the wrong tool for it.

How it works

Two monitors and two places to put a ping.

1

Add a heartbeat job to each queue

Schedule a job that only requests the ping URL of a heartbeat monitor, once a minute, on every queue you care about. It arrives only while the scheduler, the broker and a worker on that queue all work.

2

Wrap jobs with start and finish pings

From one hook per framework, send /start when a job begins and /success or /failure when it ends, with the job id as run_id. Each job class pings its own event-driven monitor.

3

Set the limits that turn silence into an alert

On the heartbeat monitor: the interval and a grace period. On the event-driven monitor: max_duration_seconds, after which a run with a start and no finish is recorded as failed.

Where the pings go in Sidekiq, Celery, BullMQ, RQ and Laravel

Each framework has one place that runs around every job and one way to schedule a job. Those two are all queue worker monitoring needs. The heartbeat job pings one heartbeat monitor. Each job class pings its own event-driven monitor, found by its slug. The snippets read two URLs from the environment:

  • DRUMBEATS_HEARTBEAT_URL: https://api.drumbeats.io/v1/ping/<heartbeat-monitor-id>/success
  • DRUMBEATS_PING_URL: https://api.drumbeats.io/v1/s-ping/<project-id>

The Sidekiq, Celery and BullMQ snippets were run on 15 November 2026 against Sidekiq 6.5, Celery 5.6 and BullMQ 6.7. The RQ and Laravel snippets follow the RQ 3.0 and Laravel 13 documentation and source, and were not run.

Sidekiq

Ruby
  • Live processes: Sidekiq::ProcessSet lists them, with data refreshed every 5 seconds (API).
  • Killed mid-job: open-source Sidekiq fetches with BRPOP, so a job that was running when the process died is lost. Sidekiq Pro's super_fetch recovers it (Reliability).
  • Shutdown: a job still running when the -t timeout ends is terminated and pushed back to Redis to run again (Signals). The middleware below closes that run so it is not reported as hung.
  • Failures: a job is retried 25 times over about 21 days before it moves to the Dead set (Error Handling). The middleware reports the first failed attempt, not the last.
  • Recurring jobs are a Sidekiq Enterprise feature. On open-source Sidekiq, enqueue the heartbeat from the scheduler you already run, such as the sidekiq-cron gem or system cron.

Heartbeat job

# app/sidekiq/queue_heartbeat_job.rb
require "net/http"

class QueueHeartbeatJob
  include Sidekiq::Job
  sidekiq_options queue: "default", retry: false

  def perform
    uri = URI(ENV.fetch("DRUMBEATS_HEARTBEAT_URL"))
    Net::HTTP.start(uri.host, uri.port,
                    use_ssl: uri.scheme == "https",
                    open_timeout: 5, read_timeout: 5) do |http|
      http.get(uri.request_uri)
    end
  end
end

# Enqueue it every minute. With Sidekiq Enterprise:
Sidekiq.configure_server do |config|
  config.periodic do |mgr|
    mgr.register("* * * * *", "QueueHeartbeatJob")
  end
end
# app/sidekiq/queue_heartbeat_job.rb
require "net/http"

class QueueHeartbeatJob
  include Sidekiq::Job
  sidekiq_options queue: "default", retry: false

  def perform
    uri = URI(ENV.fetch("DRUMBEATS_HEARTBEAT_URL"))
    Net::HTTP.start(uri.host, uri.port,
                    use_ssl: uri.scheme == "https",
                    open_timeout: 5, read_timeout: 5) do |http|
      http.get(uri.request_uri)
    end
  end
end

# Enqueue it every minute. With Sidekiq Enterprise:
Sidekiq.configure_server do |config|
  config.periodic do |mgr|
    mgr.register("* * * * *", "QueueHeartbeatJob")
  end
end

Start and finish pings: server middleware

# config/initializers/drumbeats.rb
require "net/http"

class DrumbeatsMiddleware
  include Sidekiq::ServerMiddleware

  def call(_instance, job, _queue)
    return yield if job["class"] == "QueueHeartbeatJob"

    # One monitor per job class: Billing::InvoiceJob pings the
    # monitor whose slug is "billing-invoicejob".
    slug = job["class"].downcase.gsub(/[^a-z0-9]+/, "-")[0, 50]
    # The jid is reused by retries and by reruns after a shutdown.
    run_id = "#{job["jid"]}-#{Time.now.to_i}"
    ping(slug, "start", run_id)
    begin
      yield
    rescue Sidekiq::Shutdown
      # Deploy or restart: Sidekiq pushes the job back and runs it
      # again. Close this run so it is not failed as hung.
      ping(slug, "success", run_id)
      raise
    rescue StandardError
      ping(slug, "failure", run_id)
      raise
    end
    ping(slug, "success", run_id)
  end

  private

  def ping(slug, event, run_id)
    base = ENV.fetch("DRUMBEATS_PING_URL")
    uri = URI("#{base}/#{slug}/#{event}?run_id=#{run_id}")
    Net::HTTP.start(uri.host, uri.port,
                    use_ssl: uri.scheme == "https",
                    open_timeout: 3, read_timeout: 3) do |http|
      http.get(uri.request_uri)
    end
  rescue StandardError
    nil # a failed ping must not fail the job
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware { |chain| chain.add DrumbeatsMiddleware }
end
# config/initializers/drumbeats.rb
require "net/http"

class DrumbeatsMiddleware
  include Sidekiq::ServerMiddleware

  def call(_instance, job, _queue)
    return yield if job["class"] == "QueueHeartbeatJob"

    # One monitor per job class: Billing::InvoiceJob pings the
    # monitor whose slug is "billing-invoicejob".
    slug = job["class"].downcase.gsub(/[^a-z0-9]+/, "-")[0, 50]
    # The jid is reused by retries and by reruns after a shutdown.
    run_id = "#{job["jid"]}-#{Time.now.to_i}"
    ping(slug, "start", run_id)
    begin
      yield
    rescue Sidekiq::Shutdown
      # Deploy or restart: Sidekiq pushes the job back and runs it
      # again. Close this run so it is not failed as hung.
      ping(slug, "success", run_id)
      raise
    rescue StandardError
      ping(slug, "failure", run_id)
      raise
    end
    ping(slug, "success", run_id)
  end

  private

  def ping(slug, event, run_id)
    base = ENV.fetch("DRUMBEATS_PING_URL")
    uri = URI("#{base}/#{slug}/#{event}?run_id=#{run_id}")
    Net::HTTP.start(uri.host, uri.port,
                    use_ssl: uri.scheme == "https",
                    open_timeout: 3, read_timeout: 3) do |http|
      http.get(uri.request_uri)
    end
  rescue StandardError
    nil # a failed ping must not fail the job
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware { |chain| chain.add DrumbeatsMiddleware }
end

Celery

Python
  • Live workers: each worker emits worker-heartbeat events for event consumers such as Flower, and celery -A proj status lists the nodes that answer (Monitoring and Management Guide).
  • Killed mid-task: a task message is acknowledged just before the task runs, so a task that was running when its worker died is not run again. task_acks_late moves the acknowledgement to after the task, and a task is then redelivered if the whole worker is lost. A child process that is killed is still acknowledged unless task_reject_on_worker_lost is set (Configuration).
  • On the Redis transport, redelivery waits for the visibility timeout, 1 hour by default (Using Redis).
  • Hung tasks: a task has no time limit unless you set task_time_limit or task_soft_time_limit.
  • Scheduler: celery beat is a separate process that sends periodic tasks to the queue (Periodic Tasks). When it stops, no task is sent and no worker logs an error.

Heartbeat task on beat

# tasks.py
import os

import requests

@app.task(ignore_result=True)
def queue_heartbeat():
    requests.get(os.environ["DRUMBEATS_HEARTBEAT_URL"], timeout=5)

app.conf.beat_schedule = {
    "queue-heartbeat": {
        "task": "tasks.queue_heartbeat",
        "schedule": 60.0,
        # Goes to the default queue, "celery". For a named queue
        # add "queue": "emails" to the options. "expires" drops a
        # heartbeat that was never run, so a worker that comes
        # back does not replay a backlog of them.
        "options": {"expires": 50},
    },
}
# tasks.py
import os

import requests

@app.task(ignore_result=True)
def queue_heartbeat():
    requests.get(os.environ["DRUMBEATS_HEARTBEAT_URL"], timeout=5)

app.conf.beat_schedule = {
    "queue-heartbeat": {
        "task": "tasks.queue_heartbeat",
        "schedule": 60.0,
        # Goes to the default queue, "celery". For a named queue
        # add "queue": "emails" to the options. "expires" drops a
        # heartbeat that was never run, so a worker that comes
        # back does not replay a backlog of them.
        "options": {"expires": 50},
    },
}

Start and finish pings: signals

# drumbeats_signals.py: import it where your app is defined
import os
import re

import requests
from celery.signals import task_postrun, task_prerun

def ping(event, task_id, task):
    if task.name == "tasks.queue_heartbeat":
        return
    # One monitor per task: tasks.send_invoice pings the monitor
    # whose slug is "tasks-send-invoice".
    slug = re.sub(r"[^a-z0-9]+", "-", task.name.lower())[:50]
    # task_id is reused across retries: add the retry count.
    run_id = f"{task_id}-{task.request.retries}"
    url = f"{os.environ['DRUMBEATS_PING_URL']}/{slug}/{event}"
    try:
        requests.get(url, params={"run_id": run_id}, timeout=3)
    except requests.RequestException:
        pass  # a failed ping must not fail the task

@task_prerun.connect
def on_start(task_id=None, task=None, **kwargs):
    ping("start", task_id, task)

@task_postrun.connect
def on_finish(task_id=None, task=None, state=None, **kwargs):
    if state == "SUCCESS":
        ping("success", task_id, task)
    elif state in ("FAILURE", "RETRY"):
        ping("failure", task_id, task)
# drumbeats_signals.py: import it where your app is defined
import os
import re

import requests
from celery.signals import task_postrun, task_prerun

def ping(event, task_id, task):
    if task.name == "tasks.queue_heartbeat":
        return
    # One monitor per task: tasks.send_invoice pings the monitor
    # whose slug is "tasks-send-invoice".
    slug = re.sub(r"[^a-z0-9]+", "-", task.name.lower())[:50]
    # task_id is reused across retries: add the retry count.
    run_id = f"{task_id}-{task.request.retries}"
    url = f"{os.environ['DRUMBEATS_PING_URL']}/{slug}/{event}"
    try:
        requests.get(url, params={"run_id": run_id}, timeout=3)
    except requests.RequestException:
        pass  # a failed ping must not fail the task

@task_prerun.connect
def on_start(task_id=None, task=None, **kwargs):
    ping("start", task_id, task)

@task_postrun.connect
def on_finish(task_id=None, task=None, state=None, **kwargs):
    if state == "SUCCESS":
        ping("success", task_id, task)
    elif state in ("FAILURE", "RETRY"):
        ping("failure", task_id, task)

BullMQ

Node.js
  • Killed mid-job: a job holds a lock (lockDuration, 30 seconds) that its worker keeps renewing. Every worker looks for expired locks every 30 seconds (stalledInterval), moves a stalled job back to waiting once (maxStalledCount is 1) and fails it the second time (Stalled Jobs).
  • That check runs inside workers. When the only worker on a queue dies, nothing is left to run it.
  • Scheduler: a Job Scheduler creates the next job only when a worker starts the current one (Job Schedulers). With no worker, or after Redis loses its keys, nothing is scheduled and nothing throws. That makes a scheduled heartbeat job a check on both.
  • Errors: attach an error listener. Without one the worker may stop processing jobs when an error is emitted (Workers).
  • We broke a BullMQ 6 setup four ways and timed each alert: monitoring BullMQ workers, job schedulers and an outbox relay.

Heartbeat job on a Job Scheduler

import { Queue } from 'bullmq';

const emails = new Queue('emails', { connection });

// Once at boot: one heartbeat job a minute on this queue.
await emails.upsertJobScheduler(
  'queue-heartbeat',
  { every: 60_000 },
  { name: 'queue-heartbeat' },
);
import { Queue } from 'bullmq';

const emails = new Queue('emails', { connection });

// Once at boot: one heartbeat job a minute on this queue.
await emails.upsertJobScheduler(
  'queue-heartbeat',
  { every: 60_000 },
  { name: 'queue-heartbeat' },
);

Start and finish pings: wrap the processor

import {
  DelayedError,
  RateLimitError,
  WaitingChildrenError,
  WaitingError,
  Worker,
  type Processor,
} from 'bullmq';

const pingUrl = process.env.DRUMBEATS_PING_URL!;
const heartbeatUrl = process.env.DRUMBEATS_HEARTBEAT_URL!;

// A failed or slow ping must not fail the job.
const get = (url: string) =>
  fetch(url, { signal: AbortSignal.timeout(3000) }).catch(() => {});

// One monitor per job name: "send-receipt" pings the monitor
// whose slug is "send-receipt".
const slugOf = (name: string) =>
  name.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 50);

// A processor throws these to say "moved", not "failed".
const moved = (err: unknown) =>
  err instanceof DelayedError ||
  err instanceof RateLimitError ||
  err instanceof WaitingChildrenError ||
  err instanceof WaitingError;

const monitored =
  (processor: Processor): Processor =>
  async (job, token, signal) => {
    if (job.name === 'queue-heartbeat') {
      await get(heartbeatUrl);
      return;
    }
    // job.id is reused across retries: add the attempt number.
    const run = encodeURIComponent(`${job.id}-${job.attemptsStarted}`);
    const url = (event: string) =>
      `${pingUrl}/${slugOf(job.name)}/${event}?run_id=${run}`;
    await get(url('start'));
    try {
      const result = await processor(job, token, signal);
      await get(url('success'));
      return result;
    } catch (err) {
      // A moved job runs again later: close this run, do not fail it.
      await get(url(moved(err) ? 'success' : 'failure'));
      throw err;
    }
  };

const worker = new Worker('emails', monitored(sendEmail), {
  connection,
});
worker.on('error', (err) => console.error(err));
import {
  DelayedError,
  RateLimitError,
  WaitingChildrenError,
  WaitingError,
  Worker,
  type Processor,
} from 'bullmq';

const pingUrl = process.env.DRUMBEATS_PING_URL!;
const heartbeatUrl = process.env.DRUMBEATS_HEARTBEAT_URL!;

// A failed or slow ping must not fail the job.
const get = (url: string) =>
  fetch(url, { signal: AbortSignal.timeout(3000) }).catch(() => {});

// One monitor per job name: "send-receipt" pings the monitor
// whose slug is "send-receipt".
const slugOf = (name: string) =>
  name.toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 50);

// A processor throws these to say "moved", not "failed".
const moved = (err: unknown) =>
  err instanceof DelayedError ||
  err instanceof RateLimitError ||
  err instanceof WaitingChildrenError ||
  err instanceof WaitingError;

const monitored =
  (processor: Processor): Processor =>
  async (job, token, signal) => {
    if (job.name === 'queue-heartbeat') {
      await get(heartbeatUrl);
      return;
    }
    // job.id is reused across retries: add the attempt number.
    const run = encodeURIComponent(`${job.id}-${job.attemptsStarted}`);
    const url = (event: string) =>
      `${pingUrl}/${slugOf(job.name)}/${event}?run_id=${run}`;
    await get(url('start'));
    try {
      const result = await processor(job, token, signal);
      await get(url('success'));
      return result;
    } catch (err) {
      // A moved job runs again later: close this run, do not fail it.
      await get(url(moved(err) ? 'success' : 'failure'));
      throw err;
    }
  };

const worker = new Worker('emails', monitored(sendEmail), {
  connection,
});
worker.on('error', (err) => console.error(err));

RQ

Python
  • Live workers: rq info lists queues and workers (Monitoring), and Worker.all() returns each worker with its last_heartbeat (Workers).
  • Hung jobs: a job is stopped at job_timeout, 180 seconds by default, and recorded as failed (Results).
  • Killed mid-job: after a kill -9 the job ends up in FailedJobRegistry later, when a cleanup task raises AbandonedJobError (Results, under "Dealing with Interruptions").
  • Webhooks: in recent RQ 2.x releases a job can carry Webhook objects that request a URL when it finishes or fails. A failed webhook is not sent for an attempt that will be retried (Webhooks).
  • A webhook has no start event, so these runs have no duration in Drumbeats and no hung-run check. RQ applies job_timeout itself.

Heartbeat job on rq cron

# cron_config.py, started with: rq cron cron_config.py
# (CronScheduler is marked beta in the RQ docs)
import os

from rq import Webhook, cron

from myapp.jobs import noop  # def noop(): return None

cron.register(
    noop,
    queue_name="default",
    interval=60,
    webhooks=[
        Webhook(os.environ["DRUMBEATS_HEARTBEAT_URL"], "finished"),
    ],
)
# cron_config.py, started with: rq cron cron_config.py
# (CronScheduler is marked beta in the RQ docs)
import os

from rq import Webhook, cron

from myapp.jobs import noop  # def noop(): return None

cron.register(
    noop,
    queue_name="default",
    interval=60,
    webhooks=[
        Webhook(os.environ["DRUMBEATS_HEARTBEAT_URL"], "finished"),
    ],
)

Outcome pings: webhooks on the job

import os

from redis import Redis
from rq import Queue, Webhook

from myapp.jobs import send_invoice

ping_url = os.environ["DRUMBEATS_PING_URL"]

def outcome(slug):
    # One monitor per job function, addressed by its slug.
    return [
        Webhook(f"{ping_url}/{slug}/success", "finished"),
        Webhook(f"{ping_url}/{slug}/failure", "failed"),
    ]

queue = Queue("default", connection=Redis())
queue.enqueue(send_invoice, invoice_id,
              webhooks=outcome("send-invoice"))
import os

from redis import Redis
from rq import Queue, Webhook

from myapp.jobs import send_invoice

ping_url = os.environ["DRUMBEATS_PING_URL"]

def outcome(slug):
    # One monitor per job function, addressed by its slug.
    return [
        Webhook(f"{ping_url}/{slug}/success", "finished"),
        Webhook(f"{ping_url}/{slug}/failure", "failed"),
    ]

queue = Queue("default", connection=Redis())
queue.enqueue(send_invoice, invoice_id,
              webhooks=outcome("send-invoice"))

Laravel queues

PHP
  • Process supervision: queue:work exits when a job runs past --timeout (60 seconds by default) and relies on a process monitor such as Supervisor to start it again (Queues).
  • Killed mid-job: a job that is still reserved after retry_after seconds is released back onto the queue (Job Expirations and Timeouts).
  • Scheduler: Laravel's scheduling docs use Schedule::job(new Heartbeat)->everyFiveMinutes() as their example of a scheduled queued job (Task Scheduling). It only runs while schedule:run is called every minute.
  • Events: JobProcessed fires whenever a job returns without throwing, which includes a job that called fail() or release(). A job stopped by --timeout fires JobTimedOut instead. The snippet below handles both.

Heartbeat job on the scheduler

// app/Jobs/QueueHeartbeat.php
namespace App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Http;

class QueueHeartbeat implements ShouldQueue
{
    use Queueable;

    public function handle(): void
    {
        Http::timeout(5)->get(
            config('services.drumbeats.heartbeat_url')
        );
    }
}

// routes/console.php
use App\Jobs\QueueHeartbeat;
use Illuminate\Support\Facades\Schedule;

Schedule::job(new QueueHeartbeat, 'default')->everyMinute();
// app/Jobs/QueueHeartbeat.php
namespace App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Http;

class QueueHeartbeat implements ShouldQueue
{
    use Queueable;

    public function handle(): void
    {
        Http::timeout(5)->get(
            config('services.drumbeats.heartbeat_url')
        );
    }
}

// routes/console.php
use App\Jobs\QueueHeartbeat;
use Illuminate\Support\Facades\Schedule;

Schedule::job(new QueueHeartbeat, 'default')->everyMinute();

Start and finish pings: queue events

// app/Providers/AppServiceProvider.php
use App\Jobs\QueueHeartbeat;
use Illuminate\Queue\Events\JobExceptionOccurred;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Queue\Events\JobTimedOut;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Str;

// inside boot()
$ping = function (string $event, $job): void {
    $class = $job->resolveName();
    if ($class === QueueHeartbeat::class) {
        return;
    }
    // One monitor per job class: App\Jobs\SendInvoice pings the
    // monitor whose slug is "send-invoice". The uuid is reused
    // across retries, so attempts() is added to the run id.
    $slug = Str::kebab(class_basename($class));
    rescue(fn () => Http::timeout(3)->get(
        config('services.drumbeats.ping_url')."/{$slug}/{$event}",
        ['run_id' => $job->uuid().'-'.$job->attempts()],
    ), report: false);
};

Queue::before(
    fn (JobProcessing $e) => $ping('start', $e->job)
);
// Also fires after fail() and release(): a failed job reports a
// failure, a released job is closed as a success.
Queue::after(fn (JobProcessed $e) => $ping(
    $e->job->hasFailed() ? 'failure' : 'success', $e->job
));
Queue::exceptionOccurred(
    fn (JobExceptionOccurred $e) => $ping('failure', $e->job)
);
// A job stopped by --timeout: this fires, then the worker exits.
Event::listen(
    fn (JobTimedOut $e) => $ping('failure', $e->job)
);
// app/Providers/AppServiceProvider.php
use App\Jobs\QueueHeartbeat;
use Illuminate\Queue\Events\JobExceptionOccurred;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Queue\Events\JobTimedOut;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Str;

// inside boot()
$ping = function (string $event, $job): void {
    $class = $job->resolveName();
    if ($class === QueueHeartbeat::class) {
        return;
    }
    // One monitor per job class: App\Jobs\SendInvoice pings the
    // monitor whose slug is "send-invoice". The uuid is reused
    // across retries, so attempts() is added to the run id.
    $slug = Str::kebab(class_basename($class));
    rescue(fn () => Http::timeout(3)->get(
        config('services.drumbeats.ping_url')."/{$slug}/{$event}",
        ['run_id' => $job->uuid().'-'.$job->attempts()],
    ), report: false);
};

Queue::before(
    fn (JobProcessing $e) => $ping('start', $e->job)
);
// Also fires after fail() and release(): a failed job reports a
// failure, a released job is closed as a success.
Queue::after(fn (JobProcessed $e) => $ping(
    $e->job->hasFailed() ? 'failure' : 'success', $e->job
));
Queue::exceptionOccurred(
    fn (JobExceptionOccurred $e) => $ping('failure', $e->job)
);
// A job stopped by --timeout: this fires, then the worker exits.
Event::listen(
    fn (JobTimedOut $e) => $ping('failure', $e->job)
);

Why one monitor per job class: a monitor counts failures in a row across everything that pings it, and any success resets the count. On a shared monitor, a payment job that fails every time is recovered by the next email that succeeds. Create a monitor for each job class you care about and give it the slug the snippet derives: lower-case letters, digits and hyphens, up to 50 characters. A ping to a slug with no monitor gets a 404, which these snippets ignore, so other job classes stay untracked. The ping API reference describes the slug URL, and production hardening covers timeouts and retries for the ping itself.

Where the worker heartbeat goes

A heartbeat has to come from the path a real job takes. A timer thread that pings every minute keeps pinging while the worker is disconnected from the broker, which is the failure it was meant to catch.

A framework runs the loop

Sidekiq, Celery, BullMQ, RQ, Laravel queues

You do not own the code that fetches jobs, so there is no loop to ping from. Schedule a heartbeat job on each queue, once a minute, whose only work is one GET to the heartbeat monitor's URL.

What a ping proves

The scheduler enqueued it, the broker held it, and a worker listening on that queue ran it.

What it does not cover

Which of several workers ran it, and any queue other than the one it was scheduled on.

You wrote the loop

SQS, Kafka and RabbitMQ consumers, polling loops, an outbox relay

Ping at the end of every iteration, including the ones that received nothing, and at most once per interval. A loop that pings only after it handled a message looks dead whenever the queue is empty.

What a ping proves

The loop is turning and the receive call returns.

What it does not cover

Whether each message was handled correctly. Put start and finish pings around the handler for that.

The job re-enqueues itself

A poller that ends with perform_in(5.minutes) or a delayed queue.add()

Ping at the end of each run and give the heartbeat monitor the same interval as the delay. The schedule lives inside the job, so an exception before the re-enqueue line ends the chain and nothing else is due to run.

What a ping proves

The chain is still alive.

What it does not cover

A second copy of the chain. Two chains running at once still send pings on time.

A loop you wrote: ping once per interval, work or no work

The same shape works for an SQS poller, a Kafka consumer or a relay that moves outbox rows to a queue. Set the heartbeat monitor to a 1m interval. Each ping moves the deadline to one interval after it arrived, so a loop that pings a few seconds late does not drift into a miss. The grace period only has to cover the longest single iteration.

The producer needs its own check

An empty queue with idle workers looks the same on a quiet day and on the day the producer broke. A cron job that enqueues work gets a cron monitor. A webhook handler that enqueues work gets start and finish pings around the handler, enqueue call included, which is what background job monitoring covers.

import time

import requests

HEARTBEAT_URL = "https://api.drumbeats.io/v1/ping/<monitor-id>/success"
last_ping = 0.0

while True:
    for message in receive(wait_seconds=20):  # long poll
        handle(message)

    # also reached when nothing was received
    if time.monotonic() - last_ping >= 60:
        try:
            requests.get(HEARTBEAT_URL, timeout=3)
        except requests.RequestException:
            pass  # a failed ping must not stop the consumer
        last_ping = time.monotonic()
import time

import requests

HEARTBEAT_URL = "https://api.drumbeats.io/v1/ping/<monitor-id>/success"
last_ping = 0.0

while True:
    for message in receive(wait_seconds=20):  # long poll
        handle(message)

    # also reached when nothing was received
    if time.monotonic() - last_ping >= 60:
        try:
            requests.get(HEARTBEAT_URL, timeout=3)
        except requests.RequestException:
            pass  # a failed ping must not stop the consumer
        last_ping = time.monotonic()

Choosing intervals, grace periods and time limits

The first three settings belong to the heartbeat monitor, the last three to the event-driven monitor of each job class.

Monitor settings for queue worker monitoring, their defaults and how to choose each
SettingDefaultHow to choose it
Heartbeat interval (schedule)No default. The floor is 60 seconds on Free and 30 seconds on paid plans.How long a dead queue may go unnoticed. 1m fits a queue that serves users, 5m or 15m a batch queue.
grace_period_seconds300Longer than the heartbeat job normally waits in that queue at peak. It queues behind real work, so a burst that holds it up for longer than the grace period is reported as a miss.
schedule_tolerance1Missed intervals in a row before the monitor goes down. Raise it only when a single miss is routine, for example a deploy that outlasts the grace period.
max_duration_secondsNot setThe slowest run you would still call healthy, with headroom. Where the framework stops long jobs itself (Laravel's queue:work at 60 seconds by default), set it just above that limit. Without it a run that never finishes is never flagged. log pings do not extend it.
failure_tolerance1Failures in a row before the monitor goes down. The count covers every job that pings the monitor and any success resets it, which is why each job class has its own monitor. The hooks above report every failed attempt, so set it to the number of attempts you treat as routine: 3 for a mail job that retries through SMTP blips, 1 for payments.
min_duration_secondsNot setA floor below which a success is suspect. A report that normally takes 40 seconds and finishes in 1 opens a DURATION_LOW warning.

Worst case from the moment the last worker dies to the incident: one interval, plus the grace period, plus 30 seconds until the next detection pass. With a 1m interval and a 120 second grace period that is 3.5 minutes. A run that never finishes is failed on the first pass after max_duration_seconds, and that pass runs every 60 seconds. The grace period entry and the alert logic reference go further into both tolerances.

Queue dashboards, metrics and heartbeats answer different questions

A queue dashboard here means Sidekiq's Web UI, Flower, Bull Board, Horizon or rq-dashboard. Metrics and APM means queue gauges, error tracking and traces from an agent or an exporter.

What a queue dashboard, metrics or APM, and heartbeat monitoring each answer about a job queue
QuestionQueue dashboardMetrics and APMHeartbeat and per-job pings
What is in the queue right now, and can I retry or delete it?Yes. This is what a dashboard is for.Counts and rates, not individual jobs.No.
Has every worker for this queue stopped?Visible as an empty worker list, to whoever opens the page.Possible with an alert on worker count or on zero throughput. Zero throughput also fires on a quiet queue.Yes. The heartbeat job stops arriving and a MISSED incident opens.
Did the scheduler stop enqueueing?It shows an empty queue, which is also what a healthy quiet queue looks like.The same problem: no jobs is not an error.Yes. The heartbeat job is scheduled too, so it goes missing with the schedule.
Which job failed, and with what error?Yes, in the retry, dead or failed list.Yes, with a stack trace.Yes, when the hook sends the error text as the payload of the failure ping.
Why was this job slow?No.Yes. Traces and profiles show where the time went.No. You get the duration of each run and nothing inside it.
Does the check still run when the host is gone?No. It runs on your infrastructure, next to the workers it describes.A hosted backend can alert on missing data, if you write that rule.Yes. The deadline is checked on Drumbeats, and a dead host is detected by its silence.

What heartbeat monitoring does not cover

Six things it cannot tell you about a queue, and what to use for each.

Queue depth and latency
Read them from the broker: Sidekiq::Queue#latency, redis-cli llen celery, queue.getJobCounts() in BullMQ, queue:monitor in Laravel. Alert from your metrics stack, or let Horizon notify on long waits. You can also expose the number on a health endpoint: the Sidekiq wiki shows one that answers OK or UHOH from the queue latency, and an uptime monitor can check the status code or a keyword in the body.
Each worker on a shared queue
One live worker keeps the heartbeat job arriving, which is also why a rolling restart does not page anyone. To know that four of five workers are gone, alert on the worker count the framework reports, or give each worker pool its own queue and heartbeat.
Jobs that were never enqueued
Pings describe runs. A producer bug that skips the enqueue call produces no run and no ping. Monitor the producer as well.
The cause of a failure
A failure ping carries the error text you send, up to 100 KB on Free. Stack traces across services, query timings and profiles belong to an APM.
A per-job monitor that goes quiet
An event-driven monitor has no schedule, so no pings means no alert. That gap is the reason for the heartbeat job.
Your own network
A ping that cannot reach Drumbeats looks the same as a job that did not run. Give every ping a timeout and a retry: production hardening has the patterns.

The queue heartbeat in the dashboard

Three dashboard components fed with sample data: a heartbeat monitor on a 5-minute interval.

Reliability

Every expected heartbeat, on time or missed

The strip shows the expected heartbeat windows of the last 6 hours. A window that closes without a ping opens an incident on the next detection pass, which runs every 30 seconds, and the next ping resolves it.

Live status

A ping that has to pass through the queue

Sidekiq, Celery and RQ each record heartbeats from their own worker processes, and BullMQ renews a lock for every active job. Those tell the framework that a process exists. A heartbeat job tells a service outside your infrastructure that a job went into the queue and came out.

  • One heartbeat job per queue, enqueued by the framework's own scheduler
  • Outbound HTTPS only, so it works behind a firewall and inside Kubernetes
  • Per-job, cron and uptime monitors draw on the same monthly beats
  • Alerts by email, Slack, Telegram, Discord, webhook, browser push, Microsoft Teams or PagerDuty

Ping history

Every ping, with what your code sent

Each ping is listed with its time, duration, source IP and any message or payload attached to it. The history downloads as CSV.

What does it cost?

What a queue costs to monitor

A heartbeat job once a minute is 43,200 beats a month for each queue. A start ping and a finish ping are 2 beats per job, and a failure ping that carries an error message costs at least one beat more. Free includes 200,000 beats a month: one queue heartbeat leaves room for about 78,000 jobs.

200,000 beats a month for $0

Pro is $20 a month for 1,000,000 beats: one queue heartbeat and about 478,000 jobs. A queue busier than that can keep the heartbeat and send only failure pings. Cron, heartbeat and uptime monitors draw on the same beats.

FAQ

Common questions

Should I monitor the queue or the workers?

Both, because they fail differently. A heartbeat tells you that nothing is taking jobs, and per-job pings tell you that a job failed or hung. Neither measures a backlog that grows while the workers stay busy: that takes queue latency, the age of the oldest waiting job, read from the broker. Start with the heartbeat. A queue with no worker makes no progress at all, and nothing in the system reports it.

How do I know a queue worker died?

From outside it. A dead worker cannot report its own death, and the enqueueing side keeps working. Have a monitor expect the heartbeat job every minute: when it is late by more than the grace period, Drumbeats opens a MISSED incident and alerts. The frameworks keep their own worker lists (Sidekiq::ProcessSet, celery -A proj status, rq info), which answer the question for someone who is looking.

Do I need a heartbeat on every queue?

On every queue that has its own workers. If one worker pool consumes default, mailers and low, one heartbeat job shows that the pool is alive. A pool that reads its queues in strict priority order may still not reach low for a long time, so put the heartbeat on the queue whose silence you want to hear about.

Does the heartbeat raise false alarms on an idle or a busy queue?

Not on an idle one: the heartbeat job is its own traffic and does not depend on real jobs arriving. On a busy queue it waits its turn. A burst that holds it up for longer than the grace period is reported as a miss, and the next heartbeat that gets through resolves it. Set the grace period above the normal peak wait.

How do I monitor Celery beat or a BullMQ job scheduler?

Schedule the heartbeat job with that scheduler. If beat stops or the BullMQ job scheduler is lost from Redis, the heartbeat job is no longer enqueued and the monitor reports a miss. A scheduled job that matters on its own, such as a nightly export, should get a cron monitor with the same cron expression.

How much does a ping add to each job?

Two HTTPS requests, one before and one after. Give each a timeout of a few seconds and never let a failed ping fail the job; the snippets on this page do both. A monitor accepts 600 pings a minute, which is 300 runs a minute of one job class at two pings each. Above that rate, send only the failure pings for that class.

Does it work with SQS, RabbitMQ or Kafka consumers?

Yes. A ping is a plain HTTPS request, so any consumer that can make an outbound request can send one, and there is no SDK or agent to install. In a consumer loop you wrote yourself, ping once per interval at the end of an iteration, as in the loop example above.

Put a heartbeat on your busiest queue

Create a heartbeat monitor, schedule the heartbeat job from the snippet for your framework, and stop the worker once to see the alert arrive by email, Slack or another of the 8 channels.

No credit card required · 50 monitors and 200,000 beats a month free

Keep exploring

What to read next

Related monitoring

  • Background job monitoring

    Start and finish pings for any background job, queued or not: webhook handlers, exports, CI steps.

  • Heartbeat monitoring

    The dead-man-switch model on its own, for daemons and loops that are not queue workers.

  • Cron job monitoring

    For the scheduled jobs that feed a queue, checked against their cron expression.

  • Uptime monitoring

    HTTP checks, including one against a queue-latency health endpoint.

Free tools

  • AI agent setup

    Create the heartbeat and per-job monitors from Claude, Cursor or VS Code through the Drumbeats MCP server.

  • Cron expression generator

    For the schedule of a producer job, or of a heartbeat job on a cron-style scheduler.

Resources