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 +4 -4
- data/lib/wellness/middleware.rb +11 -13
- data/lib/wellness/services/base.rb +0 -2
- data/lib/wellness/services/postgres_service.rb +1 -3
- data/lib/wellness/services/redis_service.rb +2 -4
- data/lib/wellness/services/sidekiq_service.rb +4 -2
- data/lib/wellness/system.rb +0 -2
- data/lib/wellness/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4e81a8991068a5d3b89047d81154d301a0766c8
|
4
|
+
data.tar.gz: 28d528329b6beda4c53c7a834230dabb3aa84c3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c992c504707bc85f21d7f2a50338e07551ca0ec389517a7f1a7dafaa0a91185d2d1f3dea3946640e3b400c80fd6d0ecb25d31436072fb723be3518fa6f352d32
|
7
|
+
data.tar.gz: c6a5d412d1c5daeab133ee2ef5a88b141c0093b2b8e04f928b33bf646a08aed3631d71b53af1e2d896ae4f2ce3271e07ca9b366710125fa24904e2e04bf14c1e
|
data/lib/wellness/middleware.rb
CHANGED
@@ -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
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
@@ -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
|
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
|
data/lib/wellness/system.rb
CHANGED
data/lib/wellness/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|