Class: ResqueToCloudwatch::Collector
- Inherits:
-
Object
- Object
- ResqueToCloudwatch::Collector
- Defined in:
- lib/resque_to_cloudwatch/collector.rb
Instance Method Summary collapse
- #get_queue_length ⇒ Object
-
#initialize(config) ⇒ Collector
constructor
A new instance of Collector.
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_length ⇒ Object
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 |