Class: Heartcheck::Monitoring::Redis
- Inherits:
-
Object
- Object
- Heartcheck::Monitoring::Redis
- Defined in:
- lib/heartcheck/monitoring/redis.rb
Overview
Handles redis monitoring, such as TCP lookup and basic operations
Class Method Summary collapse
-
.run_checks(redis_conn) ⇒ Object
Runs all checks on a given redis connection.
Instance Method Summary collapse
-
#initialize(redis_conn) ⇒ Redis
constructor
A new instance of Redis.
- #run_checks ⇒ Object
Constructor Details
#initialize(redis_conn) ⇒ Redis
Returns a new instance of Redis.
13 14 15 16 |
# File 'lib/heartcheck/monitoring/redis.rb', line 13 def initialize(redis_conn) @redis_conn = redis_conn @errors = [] end |
Class Method Details
.run_checks(redis_conn) ⇒ Object
Runs all checks on a given redis connection
9 10 11 |
# File 'lib/heartcheck/monitoring/redis.rb', line 9 def self.run_checks(redis_conn) new(redis_conn).run_checks end |
Instance Method Details
#run_checks ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/heartcheck/monitoring/redis.rb', line 18 def run_checks begin @errors << 'Sidekiq fails to set' unless can_store? @errors << 'Sidekiq fails to get' unless can_fetch? @errors << 'Sidekiq fails to delete' unless can_delete? rescue ::Redis::BaseError @errors << 'Sidekiq fails to connect to redis' rescue => e @errors << "Sidekiq error: #{e.}" end @errors end |