Class: ResqueToCloudwatch::WorkersAliveCollector

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ WorkersAliveCollector

Returns a new instance of WorkersAliveCollector.



50
51
52
# File 'lib/resque_to_cloudwatch/collectors.rb', line 50

def initialize(config)
  @config = config
end

Instance Method Details

#get_valueObject



54
55
56
57
# File 'lib/resque_to_cloudwatch/collectors.rb', line 54

def get_value
  redis = Redis.new(:host => @config.redis_host, :port => @config.redis_port)
  redis.smembers('resque:workers').length
end

#metric_nameObject



59
60
61
# File 'lib/resque_to_cloudwatch/collectors.rb', line 59

def metric_name
  "resque_workers_alive"
end

#to_sObject



63
64
65
# File 'lib/resque_to_cloudwatch/collectors.rb', line 63

def to_s
  metric_name
end