class ResqueToCloudwatch::QueueLengthCollector

Public Class Methods

new(config) click to toggle source
# File lib/resque_to_cloudwatch/collectors.rb, line 4
def initialize(config)
  @config = config
end

Public Instance Methods

get_value() click to toggle source
# File lib/resque_to_cloudwatch/collectors.rb, line 8
def get_value
  redis = Redis.new(:host => @config.redis_host, :port => @config.redis_port)
  redis.smembers('resque:queues').map do |queue_key|
    redis.llen("resque:queue:#{queue_key}")
  end.reduce(:+)
end
metric_name() click to toggle source
# File lib/resque_to_cloudwatch/collectors.rb, line 15
def metric_name
  "resque_queues"
end
to_s() click to toggle source
# File lib/resque_to_cloudwatch/collectors.rb, line 19
def to_s
  metric_name
end