Emails, exports, payments reconciliation, image processing, webhooks: much of an application's work happens in background jobs. When it fails, nothing returns an error to a user straight away. Queues grow, jobs stop running, and the first sign is a customer asking where their invoice is.
Two kinds of background work
| Kind | Example | Main risk |
|---|---|---|
| Queue-driven | Send email when a user signs up | Backlog grows; messages fail repeatedly |
| Scheduled | Nightly billing run, hourly sync | Job does not run, or fails silently |
Queue metrics that matter
- Backlog age: how old the oldest waiting message is. This maps directly to user impact ("emails are 20 minutes late") and is better than queue length for alerting.
- Throughput: messages processed per second against messages produced.
- Failure rate and retry rate per job type.
- Dead-letter queue size: messages that failed permanently.
- Processing time per job type (p50, p95).
- Workers: running vs expected; busy share.
Scheduled job metrics
- Did it run? (a heartbeat after success)
- How long did it take, compared with usual?
- Did it process the expected amount (rows exported, invoices sent)?
See cron job monitoring.
Trace from request to worker
Inject trace context into message headers when enqueuing and extract it in the worker, so the job appears in the same trace as the request that created it. Then "why did this order's confirmation email arrive late?" has a direct answer. See context propagation.
Alerts
| Alert | Example |
|---|---|
| Backlog age | Oldest message older than your target (e.g. 5 minutes for emails) |
| No progress | Throughput zero for 10 minutes while backlog exists |
| Failure rate | Above 5% for a job type for 10 minutes |
| Dead letters | Any new messages in the DLQ for critical job types |
| Missed schedule | Heartbeat missing past its grace period |
Design for observability
- Idempotent jobs, so retries are safe (idempotency keys).
- Bounded retries with backoff, then a dead-letter queue, never infinite retries.
- Timeouts on every external call inside jobs.
- Structured logs with job ID, job type and trace ID.
- Graceful shutdown that finishes or requeues in-flight jobs (guide).
Worked example
A SaaS product's invoice emails were delayed by up to three hours one morning. There was no alert: the queue length looked normal because messages were being retried, not accumulating. Traces showed every send failing with a timeout to the email provider and retrying immediately. After the incident the team alerted on backlog age (over 10 minutes) and on failure rate per job type, added backoff and a dead-letter queue, and traced jobs back to the requests that created them. The next provider incident triggered an alert within 10 minutes.
Broker-specific guides
For broker metrics, see Kafka monitoring (consumer lag) and RabbitMQ monitoring (queue depth, unacked messages, alarms). For Redis-based queues such as Sidekiq, BullMQ or Celery with Redis, watch Redis memory too; see Redis monitoring.
VitalRix covers this with APM traces that link requests to jobs, heartbeat checks for scheduled work, Collector metrics from your brokers, and alert rules routed to the owning team.
Common mistakes
- Alerting on queue length instead of age.
- Infinite retries, which hide failures and waste capacity.
- No owner for each job type.
- Scheduled jobs on one server's crontab, lost when the server is replaced.
A queue dashboard
One dashboard per queue or job family, with the same panels everywhere: backlog age, produced vs processed per minute, failures and retries by job type, dead-letter count, processing time p95, and workers running. Add deploy markers, since many job failures start with a release. With the same layout for every queue, on-call engineers can read any of them at 3 a.m. See monitoring dashboard best practices.
Ownership
Every job type should have an owning team, listed next to the queue's dashboard and alerts. When the email queue backs up at night, the alert should reach the team that can fix email sending, not a general channel.
Queue length or queue age?
Age of the oldest message is better for alerts, because it maps directly to delay users feel.
How do I know a scheduled job ran?
Have it ping a heartbeat monitor after success; a missing ping alerts.
Should failed jobs retry forever?
No. Retry a few times with backoff, then move the message to a dead-letter queue and alert.
Try VitalRix free
Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.