0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
A Resque plugin to alarm when queue is too long. Using email or rails log, or others log system. Use other tools to analyze result. Queue is checked every time job enqueued.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Resque Alarm

Send out an alarm (at this time, just support email, logger) when queue length reach a threshold.

To use this gem, config in an initializer

  require 'resque/plugins/alarm'
  require 'resque/plugins/alarm_notifier/log_notifier'
  # OR
  require 'resque/plugins/alarm_notifier/mail_notifier'

  Resque::Plugins::Alarm.configure do |config|
    config.threshold = 10 # Perform notify when queue have more than 10 items
    config.notifier = Resque::Plugins::AlarmNotifier::LogNotifier.new(Rails.logger, :info, "MyFantasticApp") # Notify to rails log
    # OR using mail notifier
    config.notifier = Resque::Plugins::AlarmNotifier::MailNotifier.new(
      "from@from.com",
      "to@to.com",
      "Queue length reached alarm", # subject
      ["Resque"] ) # tags, merge with subject to become "[Resque] Queue length reached alarm"
  end

Extend in job:

  require 'resque/plugins/alarm'

  class ResqueDoSomethingJob
    extend Resque::Plugins::Alarm

    @queue = :line1

    def self.perform(params)
      # magic come here
    end

  end

While enqueueing, if any queue has more than 10 items, a log as below will be written to rails log

  {:app=>"MyFantasticApp", :source=>"resque-queue-length-alarm", :type=>"resque_queue_too_long", :queues=>{:artwork_file_serve=>11}}

Email may be very noisy, it's better to use rails log and let log system decide email threshold.

========= AV