Monitor Background Worker Queue Processors
Ensure your application's critical background tasks are always processed by monitoring queue workers. Get alerted instantly if a worker stops pulling from the queue, preventing stalled jobs and performance issues.
The problem
Many modern applications rely on background workers and message queues (like Redis with Sidekiq or RabbitMQ with Celery) to offload critical, time-consuming tasks. If a worker process silently crashes, hangs, or stops consuming messages from its queue, critical jobs pile up unprocessed. This leads to degraded application performance, delayed customer actions (e.g., report generation, image processing), and a severe impact on user experience, often unnoticed until a backlog becomes enormous.
Imagine a Sidekiq worker responsible for processing customer-uploaded images, generating thumbnails, and storing them on S3. If this worker silently stops due to a memory leak or an unhandled exception, new images won't be processed. Users attempting to view their galleries will see broken images, and the queue will grow indefinitely. Developers typically discover this only after customers report issues or manual inspection of the queue size, by which time the backlog is significant and difficult to clear.
How Heartfly solves it
Concrete example
# Example using Sidekiq middleware or directly in a worker
class HeartflyMiddleware
def call(worker, msg, queue)
yield
# Ping Heartfly after successful job execution
Net::HTTP.get(URI.parse(ENV['HEARTFLY_PING_URL_WORKER']))
rescue StandardError => e
Rails.logger.error "Heartfly ping failed: #{e.message}"
raise # Re-raise original error
end
end
# Or, in a periodic batch processing script:
# Net::HTTP.get(URI.parse(ENV['HEARTFLY_PING_URL_BATCH_WORKER']))