health_check 2.5.0 → 2.6.0
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.
- data/CHANGELOG +2 -0
- data/README.rdoc +7 -0
- data/lib/health_check.rb +4 -3
- data/lib/health_check/utils.rb +11 -3
- data/lib/health_check/version.rb +1 -1
- data/test/setup_railsapp +5 -0
- data/test/test_with_railsapp +13 -0
- metadata +29 -19
- checksums.yaml +0 -7
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -114,6 +114,13 @@ To change the configuration of health_check, create a file `config/initializers/
|
|
114
114
|
CustomHealthCheck.perform_check # any code that returns blank on success and non blank string upon failure
|
115
115
|
end
|
116
116
|
|
117
|
+
# Add another custom check with a name, so you can call just specific custom checks. This can also be run using
|
118
|
+
# the standard 'custom' check.
|
119
|
+
# You can define multiple tests under the same name - they will be run one after the other.
|
120
|
+
config.add_custom_check('sometest') do
|
121
|
+
CustomHealthCheck.perform_another_check # any code that returns blank on success and non blank string upon failure
|
122
|
+
end
|
123
|
+
|
117
124
|
# max-age of response in seconds
|
118
125
|
# cache-control is public when max_age > 1 and basic_auth_username is not set
|
119
126
|
# You can force private without authentication for longer max_age by
|
data/lib/health_check.rb
CHANGED
@@ -53,7 +53,7 @@ module HealthCheck
|
|
53
53
|
mattr_accessor :custom_checks
|
54
54
|
mattr_accessor :full_checks
|
55
55
|
mattr_accessor :standard_checks
|
56
|
-
self.custom_checks =
|
56
|
+
self.custom_checks = { }
|
57
57
|
self.full_checks = ['database', 'migrations', 'custom', 'email', 'cache', 'redis-if-present', 'sidekiq-redis-if-present', 'resque-redis-if-present', 's3-if-present']
|
58
58
|
self.standard_checks = [ 'database', 'migrations', 'custom', 'emailconf' ]
|
59
59
|
|
@@ -63,8 +63,9 @@ module HealthCheck
|
|
63
63
|
|
64
64
|
mattr_accessor :installed_as_middleware
|
65
65
|
|
66
|
-
def self.add_custom_check(&block)
|
67
|
-
custom_checks
|
66
|
+
def self.add_custom_check(name = 'custom', &block)
|
67
|
+
custom_checks[name] ||= [ ]
|
68
|
+
custom_checks[name] << block
|
68
69
|
end
|
69
70
|
|
70
71
|
def self.setup
|
data/lib/health_check/utils.rb
CHANGED
@@ -68,13 +68,21 @@ module HealthCheck
|
|
68
68
|
when "middleware"
|
69
69
|
errors << "Health check not called from middleware - probably not installed as middleware." unless called_from_middleware
|
70
70
|
when "custom"
|
71
|
-
HealthCheck.custom_checks.each do |
|
72
|
-
|
71
|
+
HealthCheck.custom_checks.each do |name, list|
|
72
|
+
list.each do |custom_check|
|
73
|
+
errors << custom_check.call(self)
|
74
|
+
end
|
73
75
|
end
|
74
76
|
when "all", "full"
|
75
77
|
errors << HealthCheck::Utils.process_checks(HealthCheck.full_checks, called_from_middleware)
|
76
78
|
else
|
77
|
-
|
79
|
+
if HealthCheck.custom_checks.include? check
|
80
|
+
HealthCheck.custom_checks[check].each do |custom_check|
|
81
|
+
errors << custom_check.call(self)
|
82
|
+
end
|
83
|
+
else
|
84
|
+
return "invalid argument to health_test."
|
85
|
+
end
|
78
86
|
end
|
79
87
|
end
|
80
88
|
return errors
|
data/lib/health_check/version.rb
CHANGED
data/test/setup_railsapp
CHANGED
data/test/test_with_railsapp
CHANGED
@@ -402,6 +402,13 @@ common_tests()
|
|
402
402
|
echo
|
403
403
|
fi
|
404
404
|
|
405
|
+
test_no=`expr 1 + $test_no`
|
406
|
+
if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
|
407
|
+
echo "${test_no}: TESTING ${route_prefix}/pass should pass ..."
|
408
|
+
$testurl ${host}/${route_prefix}/pass 200 text/plain $success
|
409
|
+
echo
|
410
|
+
fi
|
411
|
+
|
405
412
|
test_no=`expr 1 + $test_no`
|
406
413
|
if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
|
407
414
|
echo "${test_no}: TESTING ${route_prefix}/custom should pass ..."
|
@@ -440,6 +447,12 @@ common_tests()
|
|
440
447
|
echo
|
441
448
|
fi
|
442
449
|
|
450
|
+
if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
|
451
|
+
echo "${test_no}: TESTING ${route_prefix}/pass should pass even if other custom test returns string ..."
|
452
|
+
$testurl ${host}/${route_prefix}/pass 200 text/plain $success
|
453
|
+
echo
|
454
|
+
fi
|
455
|
+
|
443
456
|
test_no=`expr 1 + $test_no`
|
444
457
|
if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
|
445
458
|
echo "${test_no}: TESTING ${route_prefix} (all) should fail when custom check fails ..."
|
metadata
CHANGED
@@ -1,72 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Ian Heggie
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '4.0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '4.0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: 0.8.3
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: 0.8.3
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: shoulda
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: 2.11.0
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: 2.11.0
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: bundler
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '1.2'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '1.2'
|
69
|
-
description: " \tSimple health check of Rails app for uptime monitoring with Pingdom,
|
78
|
+
description: ! " \tSimple health check of Rails app for uptime monitoring with Pingdom,
|
70
79
|
NewRelic, EngineYard or uptime.openacs.org etc.\n"
|
71
80
|
email:
|
72
81
|
- ian@heggie.biz
|
@@ -75,9 +84,9 @@ extensions: []
|
|
75
84
|
extra_rdoc_files:
|
76
85
|
- README.rdoc
|
77
86
|
files:
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
87
|
+
- .document
|
88
|
+
- .gitignore
|
89
|
+
- .travis.yml
|
81
90
|
- CHANGELOG
|
82
91
|
- Gemfile
|
83
92
|
- MIT-LICENSE
|
@@ -114,26 +123,27 @@ files:
|
|
114
123
|
- test/testurl
|
115
124
|
homepage: https://github.com/ianheggie/health_check
|
116
125
|
licenses: []
|
117
|
-
metadata: {}
|
118
126
|
post_install_message:
|
119
127
|
rdoc_options: []
|
120
128
|
require_paths:
|
121
129
|
- lib
|
122
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
123
132
|
requirements:
|
124
|
-
- -
|
133
|
+
- - ! '>='
|
125
134
|
- !ruby/object:Gem::Version
|
126
135
|
version: 1.9.3
|
127
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
128
138
|
requirements:
|
129
|
-
- -
|
139
|
+
- - ! '>='
|
130
140
|
- !ruby/object:Gem::Version
|
131
141
|
version: '0'
|
132
142
|
requirements: []
|
133
143
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
144
|
+
rubygems_version: 1.8.25
|
135
145
|
signing_key:
|
136
|
-
specification_version:
|
146
|
+
specification_version: 3
|
137
147
|
summary: Simple health check of Rails app for uptime monitoring with Pingdom, NewRelic,
|
138
148
|
EngineYard or uptime.openacs.org etc.
|
139
149
|
test_files:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 4b5a934dfee4618efc3d217163112b251e926879
|
4
|
-
data.tar.gz: 811fdba5dd439ef0016ca94c8c2b0b6dbac19a99
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: fd09549905a225cc3c25a02f295335dcb013cb565c52095d4b87e1fb4e74552d4231637d7a4e9b7698c28f896103cf529cd1aefbbf1089dfb1b161c650ca11da
|
7
|
-
data.tar.gz: 44fc64d17c2722c5bd3841d65dabf2bc5f55b0a61b01a862484ea79f4b64ebe29d4300667b5c6f572eb50f5c90c8be59bcb783517721c2de18e3bbdc54929f42
|