kubernetes-health 3.7.1 → 3.8.0

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: a53b0ea476aa3faef08ebb62fd3b7e9a625881fc8177b17d612625b44a220424
4
- data.tar.gz: d031a5233193abb0da1b5fd2ec00acf253e3b5ea2711ad547cbed131ac0be223
3
+ metadata.gz: adaef68a4c3f4b6e2dcb2b3c7aa5f8c4e72544b22edb147e35e2f72c3e8c6da4
4
+ data.tar.gz: 52f4cf9f5aabdf55ad239ff23fab548e3d2e883c674b7a68bef0848699774078
5
5
  SHA512:
6
- metadata.gz: cbf4b8efc0b5114eab92e2cb718e94f2f4cae89986e95f3bb8435ab4dc322401718a7d0a3398deec062e6ba5469a0bda5ad9a03f748f872707ae1baa9483a1c4
7
- data.tar.gz: f4fffaa2f5a1a5eed2e5266a81361207dd4d16b8723489188ee535ad0a7e514b5c5958ccca731f27072aad7dab013a517cf228cbcfd356b8947199cf90ba9a24
6
+ metadata.gz: ee8c2fc80a2e8635a573beb6e8298a9756aaf292c0deb658797d77cc3a3337c7e9bfd83d00409068574b538156c2836d1fc5b2c6a41e5984d759864e05850595
7
+ data.tar.gz: 99855e3a23eb0c0f3fe90957c4d106bfebdd09c0e4434a1550907b300640ba4a7ed70c3ec8a845ca1aa2e2fc9f801a2ec811e000024544587d955dfbd945d469
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "rack"
33
33
  spec.add_dependency "rails"
34
34
  spec.add_runtime_dependency 'prometheus-client', '~> 1.0'
35
- spec.add_runtime_dependency 'puma'
35
+ spec.add_runtime_dependency 'puma', '>= 5.0'
36
36
  end
@@ -12,7 +12,7 @@ module Kubernetes
12
12
  @@response_format = 'prometheus'
13
13
 
14
14
  @@request_log_callback = lambda { |req, http_code, content|
15
- Rails.logger.debug "Kubernetes Health: Rack on Migrate - Request: Path: #{req.path_info} / Params: #{req.params} / HTTP Code: #{http_code}\n#{content}" rescue nil
15
+ Rails.logger.debug "Kubernetes Health - Request: Path: #{req.path_info} / Params: #{req.params} / HTTP Code: #{http_code}\n#{content}" rescue nil
16
16
  }
17
17
 
18
18
  @@lock_or_wait = lambda { ActiveRecord::Base.connection.execute 'select pg_advisory_lock(123456789123456789);' }
@@ -1,5 +1,5 @@
1
1
  module Kubernetes
2
2
  module Health
3
- VERSION = '3.7.1'.freeze
3
+ VERSION = '3.8.0'.freeze
4
4
  end
5
5
  end
@@ -59,7 +59,7 @@ module Puma
59
59
  puma_stats = JSON.parse(puma_stats, symbolize_names: true) unless puma_stats.is_a?(Hash)
60
60
  # Including usage stats.
61
61
  puma_stats = merge_worker_status(puma_stats) if puma_stats[:worker_status].present?
62
- puma_stats[:usage] = (1 - puma_stats[:pool_capacity].to_f / puma_stats[:max_threads]).round(2)
62
+ puma_stats[:usage] = (1 - puma_stats[:pool_capacity].to_f / puma_stats[:max_threads]).round(2) if puma_stats[:pool_capacity].present?
63
63
  puma_stats
64
64
  end
65
65
 
@@ -9,26 +9,26 @@ Puma::Plugin.create do
9
9
 
10
10
  app = Puma::Kubernetes::App.new launcher
11
11
  uri = URI.parse str
12
-
13
- kubernetes = Puma::Server.new app, launcher.events
14
- kubernetes.min_threads = 0
15
- kubernetes.max_threads = 1
12
+ log_writer = launcher.respond_to?(:log_writer) ? launcher.log_writer : launcher.events
13
+ puma_options = { min_threads: 0, max_threads: 1 }
14
+ puma_options[:log_writer] = log_writer unless log_writer.nil?
15
+ puma_server = Puma::Server.new app, launcher.events, puma_options
16
16
 
17
17
  case uri.scheme
18
18
  when 'tcp'
19
- launcher.events.log "* Starting kubernetes-healh server on #{str}"
20
- kubernetes.add_tcp_listener uri.host, uri.port
19
+ log_writer.log "* Starting kubernetes-healh server on #{str}"
20
+ puma_server.add_tcp_listener uri.host, uri.port
21
21
  else
22
- launcher.events.error "Invalid control URI: #{str}"
22
+ log_writer.error "Invalid control URI: #{str}"
23
23
  end
24
24
 
25
25
  launcher.events.register(:state) do |state|
26
26
  if %i[halt restart stop].include?(state)
27
- kubernetes.stop(true) unless kubernetes.shutting_down?
27
+ puma_server.stop(true) unless puma_server.shutting_down?
28
28
  end
29
29
  end
30
30
 
31
- kubernetes.run
31
+ puma_server.run
32
32
  end
33
33
  # rubocop:enable Kubernetes/MethodLength, Kubernetes/AbcSize
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes-health
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wagner Caixeta
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '5.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '5.0'
111
111
  description: "\n This gem allows kubernetes monitoring your app while it is running
112
112
  migrates and after it started.\n Features:\n * add routes /_readiness and
113
113
  /_liveness on rails stack by default;\n * allow custom checks for /_readiness
@@ -147,7 +147,7 @@ files:
147
147
  homepage: https://github.com/platbr/kubernetes-health
148
148
  licenses: []
149
149
  metadata: {}
150
- post_install_message:
150
+ post_install_message:
151
151
  rdoc_options: []
152
152
  require_paths:
153
153
  - lib
@@ -162,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubygems_version: 3.1.4
166
- signing_key:
165
+ rubygems_version: 3.3.3
166
+ signing_key:
167
167
  specification_version: 4
168
168
  summary: This gem allows kubernetes monitoring your app while it is running migrates
169
169
  and after it started.