tp_healthcheck 0.1.2 → 0.1.3
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/README.rdoc +9 -1
- data/app/controllers/tp_healthcheck/check_controller.rb +8 -1
- data/lib/tp_healthcheck/version.rb +1 -1
- data/spec/dummy/log/test.log +27 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f4af573a6717c96ff85c7392e545d7a6656202b
|
4
|
+
data.tar.gz: 5f0d230c44c54871976e08f9984afa4db128e07e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a0268e841d05bf75450d6b4e120322e552b54eb6f2144d93a1fa9b8cc082997424fe49701bcac1fee668e61410b96c9fd9c5d073063053c0fbb842a93492ed3
|
7
|
+
data.tar.gz: ce20c6a0d22fec784cf24a36982362f210d353295248d55adbffa56b0d8b0a36f26c0b6742c7925b1000ae93c8c3658381fdc20bb879f26ae5604e4026d25ddc
|
data/README.rdoc
CHANGED
@@ -1,3 +1,11 @@
|
|
1
1
|
= Healthcheck
|
2
2
|
|
3
|
-
This project
|
3
|
+
This project provides a groups endpoints (two at the moment) for health your application.
|
4
|
+
|
5
|
+
/healtchecks/ping
|
6
|
+
Return status code 200 and application name
|
7
|
+
|
8
|
+
/healtchecks/database
|
9
|
+
Return status code 200 and string 'OK' if database have'n error. Or status code 500 otherside
|
10
|
+
|
11
|
+
This project rocks and uses MIT-LICENSE.
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class TPHealthcheck::CheckController < ApplicationController
|
3
3
|
include TPHealthcheck::DataBaseHelper
|
4
|
+
rescue_from StandardError, with: :handle_exception
|
5
|
+
|
4
6
|
def show
|
5
7
|
unless self.class.private_method_defined?(params[:cmd].to_sym)
|
6
8
|
return render json: { url: 'url not found' }.to_json, status: :not_found
|
@@ -11,7 +13,7 @@ class TPHealthcheck::CheckController < ApplicationController
|
|
11
13
|
private
|
12
14
|
|
13
15
|
def ping
|
14
|
-
render plain: Rails.application.class.parent, status: :ok
|
16
|
+
render plain: Rails.application.class.parent.to_s, status: :ok
|
15
17
|
end
|
16
18
|
|
17
19
|
def database
|
@@ -20,4 +22,9 @@ class TPHealthcheck::CheckController < ApplicationController
|
|
20
22
|
end
|
21
23
|
render plain: 'OK', status: :ok
|
22
24
|
end
|
25
|
+
|
26
|
+
def handle_exception(ex)
|
27
|
+
Rails.logger.info("handle_exception:#{ex}")
|
28
|
+
render nothing: true, status: :internal_server_error
|
29
|
+
end
|
23
30
|
end
|
data/spec/dummy/log/test.log
CHANGED
@@ -1680,6 +1680,33 @@ Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
1680
1680
|
[1m[35m (0.0ms)[0m rollback transaction
|
1681
1681
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1682
1682
|
Started GET "/healthchecks/fake" for 127.0.0.1 at 2017-02-14 17:43:23 -0200
|
1683
|
+
Processing by TPHealthcheck::CheckController#show as HTML
|
1684
|
+
Parameters: {"cmd"=>"fake"}
|
1685
|
+
Completed 404 Not Found in 0ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
1686
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1687
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
1688
|
+
Started GET "/healthchecks/ping" for 127.0.0.1 at 2017-02-16 16:26:32 -0200
|
1689
|
+
Processing by TPHealthcheck::CheckController#show as HTML
|
1690
|
+
Parameters: {"cmd"=>"ping"}
|
1691
|
+
Rendered text template (0.0ms)
|
1692
|
+
Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 0.0ms)
|
1693
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1694
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1695
|
+
Started GET "/healthchecks/ping" for 127.0.0.1 at 2017-02-16 16:26:32 -0200
|
1696
|
+
Processing by TPHealthcheck::CheckController#show as HTML
|
1697
|
+
Parameters: {"cmd"=>"ping"}
|
1698
|
+
Rendered text template (0.0ms)
|
1699
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
1700
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1701
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1702
|
+
Started GET "/healthchecks/database" for 127.0.0.1 at 2017-02-16 16:26:32 -0200
|
1703
|
+
Processing by TPHealthcheck::CheckController#show as HTML
|
1704
|
+
Parameters: {"cmd"=>"database"}
|
1705
|
+
Rendered text template (0.0ms)
|
1706
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
1707
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1708
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1709
|
+
Started GET "/healthchecks/fake" for 127.0.0.1 at 2017-02-16 16:26:32 -0200
|
1683
1710
|
Processing by TPHealthcheck::CheckController#show as HTML
|
1684
1711
|
Parameters: {"cmd"=>"fake"}
|
1685
1712
|
Completed 404 Not Found in 0ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tp_healthcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabricio Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
206
|
requirements:
|
207
207
|
- - ">="
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: '
|
209
|
+
version: '2.1'
|
210
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
212
|
- - ">="
|