racecar 2.10.0 → 2.11.0.beta2

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: f3f3ca0f465510fef5659a765dc90bc1902522b2793fa2f6af03e0be23f93f93
4
- data.tar.gz: 149a2ce49346b0a98e120d00814025fa812526fc912998b715fe5c17cd27a6c8
3
+ metadata.gz: d2abf59b968a4afc5921674e1cc54dc80fe41dcd8f7997a91f4c22c3ba50200f
4
+ data.tar.gz: 547a04288867e9a111ee1c8078cb60737c56c50000798ce7c095a86d63cf2235
5
5
  SHA512:
6
- metadata.gz: 4ded7458c65547b3d81f4027fb2472354434661912a2bea329a3014eb2dedfe946553ba79c190c5a4e45d33774a0fdae62f120e83cff7ebb8917a70e743a381b
7
- data.tar.gz: 577bbfc015b1f087ad0fe10deb6e710470526b8bb498341eb202a702fefe45c57c123530e64ca5647cfb77e9178967acb72cd1cbea3cb15cbe721e0956807bf5
6
+ metadata.gz: 286512ed59dbc271f73909350208c312bd193c6690dffcebcc48a7ffaf219b08aa502768590314c055c953f42527f47cdaa0b173106cc17a650252145f4ce961
7
+ data.tar.gz: fc93e1a80403fb1356cc0a2eac61af695be6c46b893ca41cc14ff47c58ccbaa27c43a59c5e1cad3e73dfcc729ff80c3c0db63deadbb12a2b2dc04b8a9691589f
@@ -13,7 +13,6 @@ jobs:
13
13
  strategy:
14
14
  matrix:
15
15
  ruby-version:
16
- - "2.7"
17
16
  - "3.0"
18
17
  - "3.1"
19
18
  - "3.2"
@@ -36,7 +35,7 @@ jobs:
36
35
  - name: Set up Ruby
37
36
  uses: ruby/setup-ruby@v1
38
37
  with:
39
- ruby-version: "2.7"
38
+ ruby-version: "3.0"
40
39
  bundler-cache: true
41
40
  - name: Bring up docker-compose stack
42
41
  run: docker-compose up -d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.11.0.beta2
6
+
7
+ * Add unix domain socket support for Datadog StatsD metrics
8
+ * Bump minimum rdkafka gem version to 0.15.0
9
+ * Bump minimum Ruby version to 3.0
10
+
11
+ ## 2.11.0.beta1
12
+
13
+ * Configurable strategy for consuming multiple topics
14
+
5
15
  ## 2.10.0
6
16
 
7
17
  * Bump rdkafka gem version to 0.13.0
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- racecar (2.10.0)
4
+ racecar (2.11.0.beta2)
5
5
  king_konf (~> 1.0.0)
6
- rdkafka (~> 0.13.0)
6
+ rdkafka (~> 0.15.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -19,12 +19,12 @@ GEM
19
19
  concurrent-ruby (1.2.2)
20
20
  diff-lcs (1.5.0)
21
21
  dogstatsd-ruby (5.5.0)
22
- ffi (1.15.5)
22
+ ffi (1.16.3)
23
23
  i18n (1.12.0)
24
24
  concurrent-ruby (~> 1.0)
25
25
  king_konf (1.0.1)
26
26
  method_source (1.0.0)
27
- mini_portile2 (2.8.1)
27
+ mini_portile2 (2.8.5)
28
28
  minitest (5.18.0)
29
29
  pry (0.14.2)
30
30
  coderay (~> 1.1)
@@ -33,7 +33,7 @@ GEM
33
33
  byebug (~> 11.0)
34
34
  pry (>= 0.13, < 0.15)
35
35
  rake (13.0.6)
36
- rdkafka (0.13.0)
36
+ rdkafka (0.15.1)
37
37
  ffi (~> 1.15)
38
38
  mini_portile2 (~> 2.6)
39
39
  rake (> 12)
data/README.md CHANGED
@@ -414,6 +414,7 @@ Racecar supports [Datadog](https://www.datadoghq.com/) monitoring integration. I
414
414
  - `datadog_enabled` – Whether Datadog monitoring is enabled (defaults to `false`).
415
415
  - `datadog_host` – The host running the Datadog agent.
416
416
  - `datadog_port` – The port of the Datadog agent.
417
+ - `datadog_socket_path` – The unix domain socket of the Datadog agent (when set takes precedence over host/port).
417
418
  - `datadog_namespace` – The namespace to use for Datadog metrics.
418
419
  - `datadog_tags` – Tags that should always be set on Datadog metrics.
419
420
 
@@ -695,7 +696,7 @@ In order to safely upgrade from Racecar v1 to v2, you need to completely shut do
695
696
 
696
697
  Racecar v2 requires a C library (zlib) to compress the messages before producing to the topic. If not already installed on you consumer docker container, please install using following command in Dockerfile of consumer
697
698
 
698
- ```
699
+ ```
699
700
  apt-get update && apt-get install -y libzstd-dev
700
701
  ```
701
702
 
data/lib/racecar/cli.rb CHANGED
@@ -157,10 +157,11 @@ module Racecar
157
157
  require_relative './datadog'
158
158
 
159
159
  Datadog.configure do |datadog|
160
- datadog.host = config.datadog_host unless config.datadog_host.nil?
161
- datadog.port = config.datadog_port unless config.datadog_port.nil?
162
- datadog.namespace = config.datadog_namespace unless config.datadog_namespace.nil?
163
- datadog.tags = config.datadog_tags unless config.datadog_tags.nil?
160
+ datadog.host = config.datadog_host unless config.datadog_host.nil?
161
+ datadog.port = config.datadog_port unless config.datadog_port.nil?
162
+ datadog.socket_path = config.socket_path unless config.socket_path.nil?
163
+ datadog.namespace = config.datadog_namespace unless config.datadog_namespace.nil?
164
+ datadog.tags = config.datadog_tags unless config.datadog_tags.nil?
164
165
  end
165
166
  end
166
167
  end
@@ -158,6 +158,9 @@ module Racecar
158
158
  desc "The port of the Datadog agent"
159
159
  integer :datadog_port
160
160
 
161
+ desc "The unix domain socket of the Datadog agent (when set takes precedence over host/port)"
162
+ integer :datadog_socket_path
163
+
161
164
  desc "The namespace to use for Datadog metrics"
162
165
  string :datadog_namespace
163
166
 
@@ -185,6 +188,9 @@ module Racecar
185
188
  desc "Used only by the liveness probe: Max time (in seconds) between liveness events before the process is considered not healthy"
186
189
  integer :liveness_probe_max_interval, default: 5
187
190
 
191
+ desc "Strategy for switching topics when there are multiple subscriptions. `exhaust-topic` will only switch when the consumer poll returns no messages. `round-robin` will switch after each poll regardless.\nWarning: `round-robin` will be the default in Racecar 3.x"
192
+ string :multi_subscription_strategy, allowed_values: %w(round-robin exhaust-topic), default: "exhaust-topic"
193
+
188
194
  # The error handler must be set directly on the object.
189
195
  attr_reader :error_handler
190
196
 
@@ -175,6 +175,7 @@ module Racecar
175
175
 
176
176
  # polls a message for the current consumer, handling any API edge cases.
177
177
  def poll_current_consumer(max_wait_time_ms)
178
+ @last_poll_read_nil_message = false
178
179
  msg = current.poll(max_wait_time_ms)
179
180
  rescue Rdkafka::RdkafkaError => e
180
181
  case e.code
@@ -212,9 +213,14 @@ module Racecar
212
213
  end
213
214
 
214
215
  def maybe_select_next_consumer
215
- return unless @last_poll_read_nil_message
216
- @last_poll_read_nil_message = false
217
- select_next_consumer
216
+ case @config.multi_subscription_strategy
217
+ when "round-robin"
218
+ select_next_consumer
219
+ else # "exhaust-topic"
220
+ if @last_poll_read_nil_message
221
+ select_next_consumer
222
+ end
223
+ end
218
224
  end
219
225
 
220
226
  def select_next_consumer
@@ -19,7 +19,11 @@ module Racecar
19
19
  end
20
20
 
21
21
  def statsd
22
- @statsd ||= ::Datadog::Statsd.new(host, port, namespace: namespace, tags: tags)
22
+ @statsd ||= if socket_path
23
+ ::Datadog::Statsd.new(socket_path: socket_path, namespace: namespace, tags: tags)
24
+ else
25
+ ::Datadog::Statsd.new(host, port, namespace: namespace, tags: tags)
26
+ end
23
27
  end
24
28
 
25
29
  def statsd=(statsd)
@@ -45,6 +49,15 @@ module Racecar
45
49
  clear
46
50
  end
47
51
 
52
+ def socket_path
53
+ @socket_path
54
+ end
55
+
56
+ def socket_path=(socket_path)
57
+ @socket_path = socket_path
58
+ clear
59
+ end
60
+
48
61
  def namespace
49
62
  @namespace ||= STATSD_NAMESPACE
50
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Racecar
4
- VERSION = "2.10.0"
4
+ VERSION = "2.11.0.beta2"
5
5
  end
data/racecar.gemspec CHANGED
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.required_ruby_version = '>= 2.6'
23
+ spec.required_ruby_version = '>= 3.0'
24
24
 
25
25
  spec.add_runtime_dependency "king_konf", "~> 1.0.0"
26
- spec.add_runtime_dependency "rdkafka", "~> 0.13.0"
26
+ spec.add_runtime_dependency "rdkafka", "~> 0.15.0"
27
27
 
28
28
  spec.add_development_dependency "bundler", [">= 1.13", "< 3"]
29
29
  spec.add_development_dependency "pry-byebug"
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.10.0
4
+ version: 2.11.0.beta2
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: 2024-01-09 00:00:00.000000000 Z
12
+ date: 2024-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: king_konf
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.13.0
34
+ version: 0.15.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.13.0
41
+ version: 0.15.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -222,14 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - - ">="
224
224
  - !ruby/object:Gem::Version
225
- version: '2.6'
225
+ version: '3.0'
226
226
  required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
228
  - - ">="
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.0.3.1
232
+ rubygems_version: 3.5.3
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: A framework for running Kafka consumers