Class: ResqueToCloudwatch::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/resque_to_cloudwatch/collector.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Collector

Returns a new instance of Collector.



4
5
6
# File 'lib/resque_to_cloudwatch/collector.rb', line 4

def initialize(config)
  @config = config
end

Instance Method Details

#get_queue_lengthObject



8
9
10
11
12
13
# File 'lib/resque_to_cloudwatch/collector.rb', line 8

def get_queue_length
  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