health-monitor-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
|
|
1
|
+
module HealthMonitor
|
2
|
+
class HealthController < ActionController::Base
|
3
|
+
layout nil
|
4
|
+
|
5
|
+
# GET /health/check
|
6
|
+
def check
|
7
|
+
HealthMonitor.check!
|
8
|
+
|
9
|
+
render text: "Healh check has passed: #{Time.now.to_s(:db)}\n"
|
10
|
+
rescue Exception => e
|
11
|
+
render text: "Healh check has failed: #{Time.now.to_s(:db)}, error: #{e.message}\n",
|
12
|
+
:status => :service_unavailable
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def process_with_silence(*args)
|
17
|
+
logger.quietly do
|
18
|
+
process_without_silence(*args)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method_chain :process, :silence
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health-monitor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -179,7 +179,7 @@ executables: []
|
|
179
179
|
extensions: []
|
180
180
|
extra_rdoc_files: []
|
181
181
|
files:
|
182
|
-
- app/controllers/health_controller.rb
|
182
|
+
- app/controllers/health_monitor/health_controller.rb
|
183
183
|
- config/routes.rb
|
184
184
|
- lib/health-monitor-rails.rb
|
185
185
|
- lib/health_monitor/configuration.rb
|
@@ -207,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
segments:
|
209
209
|
- 0
|
210
|
-
hash:
|
210
|
+
hash: 3575176881406320082
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
none: false
|
213
213
|
requirements:
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
version: '0'
|
217
217
|
segments:
|
218
218
|
- 0
|
219
|
-
hash:
|
219
|
+
hash: 3575176881406320082
|
220
220
|
requirements: []
|
221
221
|
rubyforge_project:
|
222
222
|
rubygems_version: 1.8.25
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class HealthController < ActionController::Base
|
2
|
-
layout nil
|
3
|
-
|
4
|
-
# GET /health/check
|
5
|
-
def check
|
6
|
-
HealthMonitor.check!
|
7
|
-
|
8
|
-
render text: "Healh check has passed: #{Time.now.to_s(:db)}\n"
|
9
|
-
rescue Exception => e
|
10
|
-
render text: "Healh check has failed: #{Time.now.to_s(:db)}, error: #{e.message}\n",
|
11
|
-
:status => :service_unavailable
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
def process_with_silence(*args)
|
16
|
-
logger.quietly do
|
17
|
-
process_without_silence(*args)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
alias_method_chain :process, :silence
|
22
|
-
end
|