Class: ResqueToCloudwatch::WorkersWorkingCollector
- Inherits:
-
Object
- Object
- ResqueToCloudwatch::WorkersWorkingCollector
- Defined in:
- lib/resque_to_cloudwatch/collectors.rb
Instance Method Summary collapse
- #get_value ⇒ Object
-
#initialize(config) ⇒ WorkersWorkingCollector
constructor
A new instance of WorkersWorkingCollector.
- #metric_name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(config) ⇒ WorkersWorkingCollector
Returns a new instance of WorkersWorkingCollector.
27 28 29 |
# File 'lib/resque_to_cloudwatch/collectors.rb', line 27 def initialize(config) @config = config end |
Instance Method Details
#get_value ⇒ Object
31 32 33 34 35 36 |
# File 'lib/resque_to_cloudwatch/collectors.rb', line 31 def get_value redis = Redis.new(:host => @config.redis_host, :port => @config.redis_port) redis.smembers('resque:workers').select do |worker_key| redis.exists("resque:worker:#{worker_key}") end.length end |
#metric_name ⇒ Object
38 39 40 |
# File 'lib/resque_to_cloudwatch/collectors.rb', line 38 def metric_name "resque_workers_working" end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/resque_to_cloudwatch/collectors.rb', line 42 def to_s metric_name end |