wellness 0.2.0 → 0.2.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: 76f9b1fdc9a32250719692af2a9edee4def359f8
4
- data.tar.gz: d3bbe4583ca4819d3384c6393cba810f50fe38d4
3
+ metadata.gz: b4e81a8991068a5d3b89047d81154d301a0766c8
4
+ data.tar.gz: 28d528329b6beda4c53c7a834230dabb3aa84c3a
5
5
  SHA512:
6
- metadata.gz: 2797c1c8566fcd651ea5e0700b702ac0527f364cc446e356a881d98f623369420e38b9dd3842a2bc66d8542a73ddad1c4e37d80103f006c00ac3876f157e1a54
7
- data.tar.gz: e5d938acabfa64b940ae2c37fdee7b8a07c87b6649fce5b58cb075f7915285be1f4ee943c42210ec95ac126e3dfc5c4434087ae43f577981ef80ac132df8ecf4
6
+ metadata.gz: c992c504707bc85f21d7f2a50338e07551ca0ec389517a7f1a7dafaa0a91185d2d1f3dea3946640e3b400c80fd6d0ecb25d31436072fb723be3518fa6f352d32
7
+ data.tar.gz: c6a5d412d1c5daeab133ee2ef5a88b141c0093b2b8e04f928b33bf646a08aed3631d71b53af1e2d896ae4f2ce3271e07ca9b366710125fa24904e2e04bf14c1e
@@ -1,7 +1,6 @@
1
1
  require 'json'
2
2
 
3
3
  module Wellness
4
-
5
4
  # This is to be put into the Rack environment.
6
5
  #
7
6
  # @author Matthew A. Johnston
@@ -11,18 +10,18 @@ module Wellness
11
10
  @system = system
12
11
 
13
12
  # Optional arguments
14
- @health_status_path = options[:status_path] || '/health/status'
13
+ @health_status_path = options[:status_path] || '/health/status'
15
14
  @health_details_path = options[:details_path] || '/health/details'
16
15
  end
17
16
 
18
17
  def call(env)
19
18
  case env['PATH_INFO']
20
- when @health_status_path
21
- health_status_check
22
- when @health_details_path
23
- health_details_check
24
- else
25
- @app.call(env)
19
+ when @health_status_path
20
+ health_status_check
21
+ when @health_details_path
22
+ health_details_check
23
+ else
24
+ @app.call(env)
26
25
  end
27
26
  end
28
27
 
@@ -30,19 +29,18 @@ module Wellness
30
29
 
31
30
  def health_status_check
32
31
  if @system.check
33
- [200, {'Content-Type' => 'text/json'}, [{status: 'HEALTHY'}.to_json]]
32
+ [200, { 'Content-Type' => 'text/json' }, [{ status: 'HEALTHY' }.to_json]]
34
33
  else
35
- [500, {'Content-Type' => 'text/json'}, [{status: 'UNHEALTHY'}.to_json]]
34
+ [500, { 'Content-Type' => 'text/json' }, [{ status: 'UNHEALTHY' }.to_json]]
36
35
  end
37
36
  end
38
37
 
39
38
  def health_details_check
40
39
  if @system.check
41
- [200, {'Content-Type' => 'text/json'}, [@system.to_json]]
40
+ [200, { 'Content-Type' => 'text/json' }, [@system.to_json]]
42
41
  else
43
- [500, {'Content-Type' => 'text/json'}, [@system.to_json]]
42
+ [500, { 'Content-Type' => 'text/json' }, [@system.to_json]]
44
43
  end
45
44
  end
46
45
  end
47
-
48
46
  end
@@ -1,6 +1,5 @@
1
1
  module Wellness
2
2
  module Services
3
-
4
3
  # @author Matthew A. Johnston
5
4
  class Base
6
5
  def initialize(params={})
@@ -43,6 +42,5 @@ module Wellness
43
42
  @last_check || {}
44
43
  end
45
44
  end
46
-
47
45
  end
48
46
  end
@@ -3,7 +3,6 @@ require 'wellness/services/base'
3
3
 
4
4
  module Wellness
5
5
  module Services
6
-
7
6
  # @author Matthew A. Johnston
8
7
  class PostgresService < Wellness::Services::Base
9
8
  def check
@@ -58,6 +57,5 @@ module Wellness
58
57
  }
59
58
  end
60
59
  end
61
-
62
60
  end
63
- end
61
+ end
@@ -3,7 +3,6 @@ require 'wellness/services/base'
3
3
 
4
4
  module Wellness
5
5
  module Services
6
-
7
6
  class RedisService < Wellness::Services::Base
8
7
  KEYS = [
9
8
  'used_memory_human',
@@ -23,8 +22,8 @@ module Wellness
23
22
  ]
24
23
 
25
24
  def check
26
- client = Redis.new(self.params)
27
- details = client.info.select { |k,_| KEYS.include?(k) }
25
+ client = Redis.new(self.params)
26
+ details = client.info.select { |k, _| KEYS.include?(k) }
28
27
 
29
28
  passed_check
30
29
  {
@@ -41,6 +40,5 @@ module Wellness
41
40
  }
42
41
  end
43
42
  end
44
-
45
43
  end
46
44
  end
@@ -1,6 +1,9 @@
1
+ require 'redis'
2
+ require 'sidekiq'
3
+ require 'wellness/services/base'
4
+
1
5
  module Wellness
2
6
  module Services
3
-
4
7
  # @author Matthew A. Johnston
5
8
  class SidekiqService < Wellness::Services::Base
6
9
  KEYS = %w(redis_stats uptime_in_days connected_clients used_memory_human used_memory_peak_human)
@@ -36,6 +39,5 @@ module Wellness
36
39
  }
37
40
  end
38
41
  end
39
-
40
42
  end
41
43
  end
@@ -1,5 +1,4 @@
1
1
  module Wellness
2
-
3
2
  # @author Matthew A. Johnston
4
3
  class System
5
4
  attr_reader :name, :services
@@ -59,5 +58,4 @@ module Wellness
59
58
  data.to_json
60
59
  end
61
60
  end
62
-
63
61
  end
@@ -1,3 +1,3 @@
1
1
  module Wellness
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wellness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Johnston
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler