deep_health_check 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071ba6ac81c18713dfcf0bcffbe653acc6615df5a20b5ddca96c00c052ee9cff
|
4
|
+
data.tar.gz: c149da4b8f07c18c5ce3969cfccb8e8287003993624ab154023ddf20ed29b4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e66155ed93d57af3980075f92126ce498031b4bf7c919812748b08947f4d452a5fe1547232344e6d1d01f61f9e376d9fac26a433f663864b10a8052e802ead72
|
7
|
+
data.tar.gz: 6e43262184f5e3172bcb5f85ef4f119b035b032623bd3f557a95924fcbfdec432fc8708f0dfdcea99b937194da90412a4ba31da8666b93c52a82ccc29b2597bc
|
@@ -11,15 +11,11 @@ module DeepHealthCheck
|
|
11
11
|
def call
|
12
12
|
return no_dependencies_response if @dependencies.nil?
|
13
13
|
|
14
|
-
api_health_check
|
14
|
+
api_health_check 200, @dependencies
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def health_status_code
|
20
|
-
raise 'health_status_code need to implmented'
|
21
|
-
end
|
22
|
-
|
23
19
|
def no_dependencies_response
|
24
20
|
api_health_check 200, 'message': "No #{@type.upcase} dependencies defined"
|
25
21
|
end
|
@@ -25,19 +25,12 @@ module DeepHealthCheck
|
|
25
25
|
threads.map(&:value).reduce(&:merge)
|
26
26
|
end
|
27
27
|
|
28
|
-
def health_status_code
|
29
|
-
failed = @dependencies.any? do |_name, response|
|
30
|
-
!response[:status] || response[:status] >= 300
|
31
|
-
end
|
32
|
-
failed ? 503 : 200
|
33
|
-
end
|
34
|
-
|
35
28
|
def http_status(url)
|
36
29
|
response = faraday.get url
|
37
30
|
response_body = extract_response_body response
|
38
31
|
{ status: response.status, details: response_body }
|
39
32
|
rescue RuntimeError, Faraday::Error => e
|
40
|
-
{ status:
|
33
|
+
{ status: 503, details: e.inspect }
|
41
34
|
end
|
42
35
|
|
43
36
|
def extract_response_body(response)
|
@@ -23,11 +23,6 @@ module DeepHealthCheck
|
|
23
23
|
threads.map(&:value).reduce(&:merge)
|
24
24
|
end
|
25
25
|
|
26
|
-
def health_status_code
|
27
|
-
faild_count = @dependencies.select { |_k, v| v == down }.count
|
28
|
-
faild_count.zero? ? 200 : 503
|
29
|
-
end
|
30
|
-
|
31
26
|
def tcp_telnet_status(host, port)
|
32
27
|
return up if Net::Telnet.new(
|
33
28
|
'Host' => host,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deep_health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Al-waleed shihadeh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
rubygems_version: 3.2.
|
189
|
+
rubygems_version: 3.2.32
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: Provides a health check API endpoint
|