okcomputer 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba26aa7d1aae0bf9b154790df6ba99e372d0f606
4
- data.tar.gz: 7db32126e1e5b5fde960295be65164932527a058
3
+ metadata.gz: c66a81d415ad030fffe85d278c09dd3b51b75314
4
+ data.tar.gz: 11edf6d3ac6964c377a60a895c755ec9567df246
5
5
  SHA512:
6
- metadata.gz: 667ec6c4c321a586c276389960bb77b65bc1a21780b90c4fd451a394762bd27cb897dd4da0db97883ca7f32a1219a939650bebee509872474efed8693e9b3e52
7
- data.tar.gz: f5d736b22f60ddd1cdd8e0c2b1c2216289af0eccbf5446280e242d00d7c23c9375576bf3c1431edaf4e37419b1e4866dd4a62d12fbae3211c67b29265209115f
6
+ metadata.gz: ad2c81d8bd4313d6b0b80ec26b4a32b9f15d8018a9631389a33e7a8519c43533d4cd887190b1adcf9b75a0d608b45a504aa475848833178394c28fca93e89cdf
7
+ data.tar.gz: 7f89ad8d20e77fa4e0610e550226dd3bed0945bd179b155aa302418b4fd68356b9724618905d9823681a9e450429401662a32f1aa9f61ce2b8d31579ecc56a4e
@@ -0,0 +1,43 @@
1
+ module OkComputer
2
+ # This class performs a health check on a Redis instance using the
3
+ # {INFO command}[http://redis.io/commands/INFO].
4
+ #
5
+ # It reports the Redis instance's memory usage, uptime, and number of
6
+ # connected clients.
7
+ class RedisCheck < Check
8
+ attr_reader :redis_config
9
+
10
+ # Public: Initialize a new Redis check.
11
+ #
12
+ # redis_config - The configuration of the Redis instance.
13
+ # Expects any valid configuration that can be passed to Redis.new.
14
+ # See https://github.com/redis/redis-rb#getting-started
15
+ def initialize(redis_config)
16
+ @redis_config = redis_config
17
+ end
18
+
19
+ # Public: Return the status of Redis.
20
+ def check
21
+ info = redis_info
22
+
23
+ mark_message "Connected to redis, #{info['used_memory_human']} used memory, uptime #{info['uptime_in_seconds']} secs, #{info['connected_clients']} connected client(s)"
24
+ rescue => e
25
+ mark_failure
26
+ mark_message "Error: '#{e}'"
27
+ end
28
+
29
+ # Returns a hash from Redis's INFO command.
30
+ def redis_info
31
+ redis.info
32
+ rescue => e
33
+ raise ConnectionFailed, e
34
+ end
35
+
36
+ # Returns a redis instance based on configuration
37
+ def redis
38
+ @redis ||= ::Redis.new(redis_config)
39
+ end
40
+
41
+ ConnectionFailed = Class.new(StandardError)
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module OkComputer
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.1'
3
3
  end
data/lib/okcomputer.rb CHANGED
@@ -15,14 +15,15 @@ require "ok_computer/built_in_checks/default_check"
15
15
  require "ok_computer/built_in_checks/delayed_job_backed_up_check"
16
16
  require "ok_computer/built_in_checks/generic_cache_check"
17
17
  require "ok_computer/built_in_checks/elasticsearch_check"
18
- require "ok_computer/built_in_checks/solr_check"
19
18
  require "ok_computer/built_in_checks/mongoid_check"
20
19
  require "ok_computer/built_in_checks/mongoid_replica_set_check"
20
+ require "ok_computer/built_in_checks/redis_check"
21
21
  require "ok_computer/built_in_checks/resque_backed_up_check"
22
22
  require "ok_computer/built_in_checks/resque_down_check"
23
23
  require "ok_computer/built_in_checks/resque_failure_threshold_check"
24
24
  require "ok_computer/built_in_checks/ruby_version_check"
25
25
  require "ok_computer/built_in_checks/sidekiq_latency_check"
26
+ require "ok_computer/built_in_checks/solr_check"
26
27
 
27
28
  OkComputer::Registry.register "default", OkComputer::DefaultCheck.new
28
29
  OkComputer::Registry.register "database", OkComputer::ActiveRecordCheck.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okcomputer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Byrne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-26 00:00:00.000000000 Z
11
+ date: 2015-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -77,6 +77,7 @@ files:
77
77
  - lib/ok_computer/built_in_checks/http_check.rb
78
78
  - lib/ok_computer/built_in_checks/mongoid_check.rb
79
79
  - lib/ok_computer/built_in_checks/mongoid_replica_set_check.rb
80
+ - lib/ok_computer/built_in_checks/redis_check.rb
80
81
  - lib/ok_computer/built_in_checks/resque_backed_up_check.rb
81
82
  - lib/ok_computer/built_in_checks/resque_down_check.rb
82
83
  - lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb