racecar 2.0.0.beta3 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/racecar/cli.rb +6 -1
- data/lib/racecar/config.rb +12 -0
- data/lib/racecar/datadog.rb +9 -18
- data/lib/racecar/runner.rb +19 -8
- data/lib/racecar/version.rb +1 -1
- data/racecar.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 122d0f341c95b64073cc1ff75891b59c08f9b841ef1245dd2d2a10c70b96677d
|
4
|
+
data.tar.gz: 3e2149507a928c8ecc89c706389d311c7852b4f22aa9d8036a5d0ca44cc4338a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49748fe4e0a549effac3b728dd43edd0885df0a3954ef20daa35f3ac5f994ad582ca0a52ef65fb04dc8dc995f0f7e051c045a2edd5f01617ba3be2fd4d4d939
|
7
|
+
data.tar.gz: f6c118896b4c4a83be5350fbeb2b3ce3be57e18fb68811a39f7aa6dd69b78a174e7ed8bd5536a10210bc37bc979eb7d5c3006160e7c750e60ed9e9ecc767fcd1
|
data/README.md
CHANGED
@@ -288,6 +288,9 @@ The memory usage limit is roughly estimated as `max_bytes * min_message_queue_si
|
|
288
288
|
* `ssl_crl_location` – Path to CRL for verifying broker's certificate validity
|
289
289
|
* `ssl_keystore_location` – Path to client's keystore (PKCS#12) used for authentication
|
290
290
|
* `ssl_keystore_password` – Client's keystore (PKCS#12) password
|
291
|
+
* `ssl_certificate_location` – Path to the certificate
|
292
|
+
* `ssl_key_location` – Path to client's certificate used for authentication
|
293
|
+
* `ssl_key_password` – Client's certificate password
|
291
294
|
|
292
295
|
#### SASL encryption, authentication & authorization
|
293
296
|
|
data/lib/racecar/cli.rb
CHANGED
@@ -102,7 +102,12 @@ module Racecar
|
|
102
102
|
opts.on("-r", "--require STRING", "Require a library before starting the consumer") do |lib|
|
103
103
|
$LOAD_PATH.unshift(Dir.pwd) unless load_path_modified
|
104
104
|
load_path_modified = true
|
105
|
-
|
105
|
+
begin
|
106
|
+
require lib
|
107
|
+
rescue => e
|
108
|
+
$stderr.puts "=> #{lib} failed to load: #{e.message}"
|
109
|
+
exit
|
110
|
+
end
|
106
111
|
end
|
107
112
|
|
108
113
|
opts.on("-l", "--log STRING", "Log to the specified file") do |logfile|
|
data/lib/racecar/config.rb
CHANGED
@@ -82,6 +82,15 @@ module Racecar
|
|
82
82
|
desc "Client's keystore (PKCS#12) password"
|
83
83
|
string :ssl_keystore_password
|
84
84
|
|
85
|
+
desc "Path to the certificate used for authentication"
|
86
|
+
string :ssl_certificate_location
|
87
|
+
|
88
|
+
desc "Path to client's certificate used for authentication"
|
89
|
+
string :ssl_key_location
|
90
|
+
|
91
|
+
desc "Client's certificate password"
|
92
|
+
string :ssl_key_password
|
93
|
+
|
85
94
|
desc "SASL mechanism to use for authentication"
|
86
95
|
string :sasl_mechanism, allowed_values: %w{GSSAPI PLAIN SCRAM-SHA-256 SCRAM-SHA-512}
|
87
96
|
|
@@ -217,6 +226,9 @@ module Racecar
|
|
217
226
|
"ssl.crl.location" => ssl_crl_location,
|
218
227
|
"ssl.keystore.location" => ssl_keystore_location,
|
219
228
|
"ssl.keystore.password" => ssl_keystore_password,
|
229
|
+
"ssl.certificate.location" => ssl_certificate_location,
|
230
|
+
"ssl.key.location" => ssl_key_location,
|
231
|
+
"ssl.key.password" => ssl_key_password,
|
220
232
|
"sasl.mechanism" => sasl_mechanism,
|
221
233
|
"sasl.kerberos.service.name" => sasl_kerberos_service_name,
|
222
234
|
"sasl.kerberos.principal" => sasl_kerberos_principal,
|
data/lib/racecar/datadog.rb
CHANGED
@@ -26,7 +26,7 @@ module Racecar
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def host
|
29
|
-
@host
|
29
|
+
@host
|
30
30
|
end
|
31
31
|
|
32
32
|
def host=(host)
|
@@ -35,7 +35,7 @@ module Racecar
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def port
|
38
|
-
@port
|
38
|
+
@port
|
39
39
|
end
|
40
40
|
|
41
41
|
def port=(port)
|
@@ -63,22 +63,6 @@ module Racecar
|
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
-
def default_host
|
67
|
-
if ::Datadog::Statsd.const_defined?(:Connection)
|
68
|
-
::Datadog::Statsd::Connection::DEFAULT_HOST
|
69
|
-
else
|
70
|
-
::Datadog::Statsd::DEFAULT_HOST
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def default_port
|
75
|
-
if ::Datadog::Statsd.const_defined?(:Connection)
|
76
|
-
::Datadog::Statsd::Connection::DEFAULT_PORT
|
77
|
-
else
|
78
|
-
::Datadog::Statsd::DEFAULT_PORT
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
66
|
def clear
|
83
67
|
@statsd && @statsd.close
|
84
68
|
@statsd = nil
|
@@ -126,6 +110,8 @@ module Racecar
|
|
126
110
|
def process_batch(event)
|
127
111
|
offset = event.payload.fetch(:last_offset)
|
128
112
|
messages = event.payload.fetch(:message_count)
|
113
|
+
last_create_time = event.payload.fetch(:last_create_time)
|
114
|
+
time_lag = last_create_time && ((Time.now - last_create_time) * 1000).to_i
|
129
115
|
tags = default_tags(event)
|
130
116
|
|
131
117
|
if event.payload.key?(:exception)
|
@@ -135,7 +121,12 @@ module Racecar
|
|
135
121
|
count("consumer.messages", messages, tags: tags)
|
136
122
|
end
|
137
123
|
|
124
|
+
histogram("consumer.batch_size", messages, tags: tags)
|
138
125
|
gauge("consumer.offset", offset, tags: tags)
|
126
|
+
|
127
|
+
if time_lag
|
128
|
+
gauge("consumer.time_lag", time_lag, tags: tags)
|
129
|
+
end
|
139
130
|
end
|
140
131
|
|
141
132
|
def join_group(event)
|
data/lib/racecar/runner.rb
CHANGED
@@ -166,11 +166,16 @@ module Racecar
|
|
166
166
|
}
|
167
167
|
|
168
168
|
@instrumenter.instrument("start_process_message", instrumentation_payload)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
169
|
+
with_pause(message.topic, message.partition, message.offset..message.offset) do
|
170
|
+
begin
|
171
|
+
@instrumenter.instrument("process_message", instrumentation_payload) do
|
172
|
+
processor.process(Racecar::Message.new(message))
|
173
|
+
processor.deliver!
|
174
|
+
consumer.store_offset(message)
|
175
|
+
end
|
176
|
+
rescue => e
|
177
|
+
config.error_handler.call(e, instrumentation_payload)
|
178
|
+
raise e
|
174
179
|
end
|
175
180
|
end
|
176
181
|
end
|
@@ -183,15 +188,21 @@ module Racecar
|
|
183
188
|
partition: first.partition,
|
184
189
|
first_offset: first.offset,
|
185
190
|
last_offset: last.offset,
|
191
|
+
last_create_time: last.timestamp,
|
186
192
|
message_count: messages.size
|
187
193
|
}
|
188
194
|
|
189
195
|
@instrumenter.instrument("start_process_batch", instrumentation_payload)
|
190
196
|
@instrumenter.instrument("process_batch", instrumentation_payload) do
|
191
197
|
with_pause(first.topic, first.partition, first.offset..last.offset) do
|
192
|
-
|
193
|
-
|
194
|
-
|
198
|
+
begin
|
199
|
+
processor.process_batch(messages.map {|message| Racecar::Message.new(message) })
|
200
|
+
processor.deliver!
|
201
|
+
consumer.store_offset(messages.last)
|
202
|
+
rescue => e
|
203
|
+
config.error_handler.call(e, instrumentation_payload)
|
204
|
+
raise e
|
205
|
+
end
|
195
206
|
end
|
196
207
|
end
|
197
208
|
end
|
data/lib/racecar/version.rb
CHANGED
data/racecar.gemspec
CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rake", "> 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_development_dependency "timecop"
|
30
|
-
spec.add_development_dependency "dogstatsd-ruby", ">=
|
30
|
+
spec.add_development_dependency "dogstatsd-ruby", ">= 4.0.0", "< 5.0.0"
|
31
31
|
spec.add_development_dependency "activesupport", ">= 4.0", "< 6.1"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: racecar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-02-
|
12
|
+
date: 2020-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: king_konf
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 4.0.0
|
111
111
|
- - "<"
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: 5.0.0
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
requirements:
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
120
|
+
version: 4.0.0
|
121
121
|
- - "<"
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: 5.0.0
|