http_health_check 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -1
- data/README.md +3 -3
- data/http_health_check.gemspec +1 -0
- data/lib/http_health_check/utils/karafka.rb +28 -0
- data/lib/http_health_check/utils.rb +7 -0
- data/lib/http_health_check/version.rb +1 -1
- data/lib/http_health_check.rb +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ae08f694494aa01e0667a635ae85163e9d675da9a8e97bb1ad9194296c113d0
|
4
|
+
data.tar.gz: 44b3ae8a18369eaf1da10c9ba7283272a395f2afda8fe6e964cc2fc1643e2bc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '069a950fe9727f24980ad7b38014d73369a7963796606c2d3fddfdfa13da3e710776ba24174dfc9d511175a65d05aa40b6b3f5d15aba3c53380f84a088af3309'
|
7
|
+
data.tar.gz: b149e9ae46abbcc0131f652135e19aca4e747adaa3f39913457a0e768f38b1b697fd470ffc1bc6e2eee952b847bf8359a1653d699a34f41cf8f0e44c9a76a6fb
|
data/.bumpversion.cfg
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
http_health_check (0.
|
4
|
+
http_health_check (0.4.0)
|
5
5
|
rack (~> 2.0)
|
6
6
|
webrick
|
7
7
|
|
@@ -66,6 +66,7 @@ GEM
|
|
66
66
|
simplecov (~> 0.19)
|
67
67
|
simplecov-html (0.12.3)
|
68
68
|
simplecov_json_formatter (0.1.4)
|
69
|
+
thor (1.1.0)
|
69
70
|
thread_safe (0.3.6)
|
70
71
|
tzinfo (1.2.9)
|
71
72
|
thread_safe (~> 0.1)
|
@@ -88,6 +89,7 @@ DEPENDENCIES
|
|
88
89
|
rubocop (~> 0.81)
|
89
90
|
simplecov
|
90
91
|
simplecov-cobertura
|
92
|
+
thor (>= 0.20)
|
91
93
|
|
92
94
|
BUNDLED WITH
|
93
95
|
2.3.15
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ HttpHealthCheck is built with kubernetes health probes in mind, but it can be us
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'http_health_check', '~> 0.
|
14
|
+
gem 'http_health_check', '~> 0.4.0'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -68,7 +68,7 @@ HttpHealthCheck.run_server_async(
|
|
68
68
|
port: 5555,
|
69
69
|
rack_app: HttpHealthCheck::RackApp.configure do |c|
|
70
70
|
c.probe '/readiness/karafka', HttpHealthCheck::Probes::RubyKafka.new(
|
71
|
-
consumer_groups:
|
71
|
+
consumer_groups: HttpHealthCheck::Utils::Karafka.consumer_groups(KarafkaApp),
|
72
72
|
# default heartbeat interval is 3 seconds, but we want to give it
|
73
73
|
# an ability to skip a few before failing the probe
|
74
74
|
heartbeat_interval_sec: 10,
|
@@ -96,7 +96,7 @@ class KarafkaApp < Karafka::App
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
|
99
|
+
HttpHealthCheck::Utils::Karafka.consumer_groups(KarafkaApp)
|
100
100
|
# => ['foo', 'foo']
|
101
101
|
```
|
102
102
|
|
data/http_health_check.gemspec
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module HttpHealthCheck
|
6
|
+
module Utils
|
7
|
+
module Karafka
|
8
|
+
# returns a list of consumer groups configured for current process
|
9
|
+
#
|
10
|
+
# @param karafka_app descendant of Karafka::App
|
11
|
+
def self.consumer_groups(karafka_app, program_name: $PROGRAM_NAME, argv: ARGV) # rubocop:disable Metrics/AbcSize
|
12
|
+
all_groups = karafka_app.consumer_groups.map(&:id)
|
13
|
+
client_id_prefix = karafka_app.config.client_id.gsub('-', '_') + '_'
|
14
|
+
|
15
|
+
return all_groups if program_name.split('/').last != 'karafka'
|
16
|
+
return all_groups if argv[0] != 'server'
|
17
|
+
|
18
|
+
parsed_option = Thor::Options.new(
|
19
|
+
consumer_groups: Thor::Option.new(:consumer_groups, type: :array, default: nil, aliases: :g)
|
20
|
+
).parse(argv).fetch('consumer_groups', []).first.to_s
|
21
|
+
return all_groups if parsed_option == ''
|
22
|
+
|
23
|
+
groups_from_option = parsed_option.split(' ').map { |g| client_id_prefix + g } & all_groups
|
24
|
+
groups_from_option.empty? ? all_groups : groups_from_option
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/http_health_check.rb
CHANGED
@@ -7,6 +7,7 @@ require_relative 'http_health_check/config/dsl'
|
|
7
7
|
require_relative 'http_health_check/probe'
|
8
8
|
require_relative 'http_health_check/rack_app'
|
9
9
|
require_relative 'http_health_check/probes'
|
10
|
+
require_relative 'http_health_check/utils'
|
10
11
|
|
11
12
|
module HttpHealthCheck
|
12
13
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SberMarket team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.81'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.20'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.20'
|
111
125
|
description: Simple and extensible HTTP health checks server.
|
112
126
|
email:
|
113
127
|
- pochi.73@gmail.com
|
@@ -141,6 +155,8 @@ files:
|
|
141
155
|
- lib/http_health_check/probes/ruby_kafka.rb
|
142
156
|
- lib/http_health_check/probes/sidekiq.rb
|
143
157
|
- lib/http_health_check/rack_app.rb
|
158
|
+
- lib/http_health_check/utils.rb
|
159
|
+
- lib/http_health_check/utils/karafka.rb
|
144
160
|
- lib/http_health_check/version.rb
|
145
161
|
homepage: https://github.com/SberMarket-Tech/http_health_check
|
146
162
|
licenses:
|