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: 0e806e827a25b48a56d508d9e002831bad2cabd996fa91ced9409bf2cf74edf4
4
- data.tar.gz: b72f0abcf77e96dc49a4968ed5094b24b70714fb721ae2c04a20067ea448b503
3
+ metadata.gz: 071ba6ac81c18713dfcf0bcffbe653acc6615df5a20b5ddca96c00c052ee9cff
4
+ data.tar.gz: c149da4b8f07c18c5ce3969cfccb8e8287003993624ab154023ddf20ed29b4e9
5
5
  SHA512:
6
- metadata.gz: 67a85264724ece119c51a703211a4010757d112120ce4ae9b6d0d6bd51f8b9b339b3b510e1b957e98efecc3b3e79c06fe732945c9fa5e4c01bac8d926e862699
7
- data.tar.gz: 4af00a8c3c81f2fcbe87f3f4482962eeb386ae60ed3adfab61c2813f7621872737cff08e2fff68eb53b05e2d1caadbbc8a60ae96e517a7b334142721da1e7650
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 health_status_code, @dependencies
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: nil, details: e.inspect }
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,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepHealthCheck
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
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.2
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-01 00:00:00.000000000 Z
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.22
189
+ rubygems_version: 3.2.32
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Provides a health check API endpoint