waterdrop 2.4.8 → 2.4.10

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: 8fab3f2b565a128bcc34f8d8bd10b36b0bd9546d1c52109a97ad87449fcd1731
4
- data.tar.gz: 891f381590986451b330f74ac0ab56e6d2873d84a778d33bf470db1fe5e8447d
3
+ metadata.gz: 1ea085fa5ca2adea3def9f04dc8ec1d228aea2cb073ec9b41dc10efd08f2fcc4
4
+ data.tar.gz: b830060cefaf8fef9e5aa68c52534300146f05eb17f151ef720eaad934208bdc
5
5
  SHA512:
6
- metadata.gz: de29a31f2d498bfd04577ddd7edec90603d1226bc9b355d3e65e62fae0e2cb0f89bc5708a0734425df0fc5458adcb01e5b59775fda3daaceab1de586b41ed07d
7
- data.tar.gz: 052ea95a7c819c42ba62c1275b4895cf9b034e429ef34af0d4556965dd28cd0a9307a0a5613f3a126b4e41da6b0cfe8042e3f614045929203faca67c496d4352
6
+ metadata.gz: 5ab0511f78ef3f1abc12c85334880df782e375ff23a14a2304b97ec78beea81a04659ec17b60a135f1e94e545463531b9202ebbc59c0273d7094b7d40b64c9a4
7
+ data.tar.gz: c1a94e01292ff4a4d4e18ae7d88714b71d68f2e36cec9dd497087d0f359e65b9a94b77d66977e3a4e233152ae657bb0d83b1421fe0409e52d419efe3e163b813
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.4.10 (2023-01-30)
4
+ - Include `caller` in the error instrumentation to align with Karafka.
5
+
6
+ ## 2.4.9 (2023-01-11)
7
+ - Remove empty debug logging out of `LoggerListener`.
8
+ - Do not lock Ruby version in Karafka in favour of `karafka-core`.
9
+ - Make sure `karafka-core` version is at least `2.0.9` to make sure we run `karafka-rdkafka`.
10
+
3
11
  ## 2.4.8 (2023-01-07)
4
12
  - Use monotonic time from Karafka core.
5
13
 
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.4.8)
5
- karafka-core (>= 2.0.8, < 3.0.0)
4
+ waterdrop (2.4.10)
5
+ karafka-core (>= 2.0.9, < 3.0.0)
6
6
  zeitwerk (~> 2.3)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.0.4)
11
+ activesupport (7.0.4.2)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
15
15
  tzinfo (~> 2.0)
16
16
  byebug (11.1.3)
17
- concurrent-ruby (1.1.10)
17
+ concurrent-ruby (1.2.0)
18
18
  diff-lcs (1.5.0)
19
19
  docile (1.4.0)
20
20
  factory_bot (6.2.1)
@@ -22,26 +22,26 @@ GEM
22
22
  ffi (1.15.5)
23
23
  i18n (1.12.0)
24
24
  concurrent-ruby (~> 1.0)
25
- karafka-core (2.0.8)
25
+ karafka-core (2.0.9)
26
26
  concurrent-ruby (>= 1.1)
27
- rdkafka (>= 0.12)
28
- mini_portile2 (2.8.1)
29
- minitest (5.17.0)
30
- rake (13.0.6)
31
- rdkafka (0.12.0)
27
+ karafka-rdkafka (>= 0.12)
28
+ karafka-rdkafka (0.12.0)
32
29
  ffi (~> 1.15)
33
30
  mini_portile2 (~> 2.6)
34
31
  rake (> 12)
32
+ mini_portile2 (2.8.1)
33
+ minitest (5.17.0)
34
+ rake (13.0.6)
35
35
  rspec (3.12.0)
36
36
  rspec-core (~> 3.12.0)
37
37
  rspec-expectations (~> 3.12.0)
38
38
  rspec-mocks (~> 3.12.0)
39
39
  rspec-core (3.12.0)
40
40
  rspec-support (~> 3.12.0)
41
- rspec-expectations (3.12.1)
41
+ rspec-expectations (3.12.2)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.12.0)
44
- rspec-mocks (3.12.1)
44
+ rspec-mocks (3.12.3)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
46
  rspec-support (~> 3.12.0)
47
47
  rspec-support (3.12.0)
@@ -51,12 +51,12 @@ GEM
51
51
  simplecov_json_formatter (~> 0.1)
52
52
  simplecov-html (0.12.3)
53
53
  simplecov_json_formatter (0.1.4)
54
- tzinfo (2.0.5)
54
+ tzinfo (2.0.6)
55
55
  concurrent-ruby (~> 1.0)
56
56
  zeitwerk (2.6.6)
57
57
 
58
58
  PLATFORMS
59
- arm64-darwin
59
+ arm64-darwin-21
60
60
  x86_64-linux
61
61
 
62
62
  DEPENDENCIES
@@ -67,4 +67,4 @@ DEPENDENCIES
67
67
  waterdrop!
68
68
 
69
69
  BUNDLED WITH
70
- 2.4.2
70
+ 2.4.5
data/README.md CHANGED
@@ -33,6 +33,7 @@ It:
33
33
  - [Instrumentation](#instrumentation)
34
34
  * [Usage statistics](#usage-statistics)
35
35
  * [Error notifications](#error-notifications)
36
+ * [Acknowledgment notifications](#acknowledgment-notifications)
36
37
  * [Datadog and StatsD integration](#datadog-and-statsd-integration)
37
38
  * [Forking and potential memory problems](#forking-and-potential-memory-problems)
38
39
  - [Middleware](#middleware)
@@ -89,6 +90,8 @@ end
89
90
 
90
91
  ### WaterDrop configuration options
91
92
 
93
+ Some of the options are:
94
+
92
95
  | Option | Description |
93
96
  |--------------------|-----------------------------------------------------------------|
94
97
  | `id` | id of the producer for instrumentation and logging |
@@ -97,6 +100,8 @@ end
97
100
  | `max_wait_timeout` | Waits that long for the delivery report or raises an error |
98
101
  | `wait_timeout` | Waits that long before re-check of delivery report availability |
99
102
 
103
+ Full list of the root configuration options is available [here](https://github.com/karafka/waterdrop/blob/master/lib/waterdrop/config.rb#L25).
104
+
100
105
  ### Kafka configuration options
101
106
 
102
107
  You can create producers with different `kafka` settings. Documentation of the available configuration options is available on https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md.
@@ -352,6 +357,65 @@ producer.close
352
357
 
353
358
  Note: The metrics returned may not be completely consistent between brokers, toppars and totals, due to the internal asynchronous nature of librdkafka. E.g., the top level tx total may be less than the sum of the broker tx values which it represents.
354
359
 
360
+ ### Error notifications
361
+
362
+ WaterDrop allows you to listen to all errors that occur while producing messages and in its internal background threads. Things like reconnecting to Kafka upon network errors and others unrelated to publishing messages are all available under `error.occurred` notification key. You can subscribe to this event to ensure your setup is healthy and without any problems that would otherwise go unnoticed as long as messages are delivered.
363
+
364
+ ```ruby
365
+ producer = WaterDrop::Producer.new do |config|
366
+ # Note invalid connection port...
367
+ config.kafka = { 'bootstrap.servers': 'localhost:9090' }
368
+ end
369
+
370
+ producer.monitor.subscribe('error.occurred') do |event|
371
+ error = event[:error]
372
+
373
+ p "WaterDrop error occurred: #{error}"
374
+ end
375
+
376
+ # Run this code without Kafka cluster
377
+ loop do
378
+ producer.produce_async(topic: 'events', payload: 'data')
379
+
380
+ sleep(1)
381
+ end
382
+
383
+ # After you stop your Kafka cluster, you will see a lot of those:
384
+ #
385
+ # WaterDrop error occurred: Local: Broker transport failure (transport)
386
+ #
387
+ # WaterDrop error occurred: Local: Broker transport failure (transport)
388
+ ```
389
+
390
+ ### Acknowledgment notifications
391
+
392
+ WaterDrop allows you to listen to Kafka messages' acknowledgment events. This will enable you to monitor deliveries of messages from WaterDrop even when using asynchronous dispatch methods.
393
+
394
+ That way, you can make sure, that dispatched messages are acknowledged by Kafka.
395
+
396
+ ```ruby
397
+ producer = WaterDrop::Producer.new do |config|
398
+ config.kafka = { 'bootstrap.servers': 'localhost:9092' }
399
+ end
400
+
401
+ producer.monitor.subscribe('message.acknowledged') do |event|
402
+ producer_id = event[:producer_id]
403
+ offset = event[:offset]
404
+
405
+ p "WaterDrop [#{producer_id}] delivered message with offset: #{offset}"
406
+ end
407
+
408
+ loop do
409
+ producer.produce_async(topic: 'events', payload: 'data')
410
+
411
+ sleep(1)
412
+ end
413
+
414
+ # WaterDrop [dd8236fff672] delivered message with offset: 32
415
+ # WaterDrop [dd8236fff672] delivered message with offset: 33
416
+ # WaterDrop [dd8236fff672] delivered message with offset: 34
417
+ ```
418
+
355
419
  ### Datadog and StatsD integration
356
420
 
357
421
  WaterDrop comes with (optional) full Datadog and StatsD integration that you can use. To use it:
@@ -385,36 +449,6 @@ You can also find [here](https://github.com/karafka/waterdrop/blob/master/lib/wa
385
449
 
386
450
  ![Example WaterDrop DD dashboard](https://raw.githubusercontent.com/karafka/misc/master/printscreens/waterdrop_dd_dashboard_example.png)
387
451
 
388
- ### Error notifications
389
-
390
- WaterDrop allows you to listen to all errors that occur while producing messages and in its internal background threads. Things like reconnecting to Kafka upon network errors and others unrelated to publishing messages are all available under `error.occurred` notification key. You can subscribe to this event to ensure your setup is healthy and without any problems that would otherwise go unnoticed as long as messages are delivered.
391
-
392
- ```ruby
393
- producer = WaterDrop::Producer.new do |config|
394
- # Note invalid connection port...
395
- config.kafka = { 'bootstrap.servers': 'localhost:9090' }
396
- end
397
-
398
- producer.monitor.subscribe('error.occurred') do |event|
399
- error = event[:error]
400
-
401
- p "WaterDrop error occurred: #{error}"
402
- end
403
-
404
- # Run this code without Kafka cluster
405
- loop do
406
- producer.produce_async(topic: 'events', payload: 'data')
407
-
408
- sleep(1)
409
- end
410
-
411
- # After you stop your Kafka cluster, you will see a lot of those:
412
- #
413
- # WaterDrop error occurred: Local: Broker transport failure (transport)
414
- #
415
- # WaterDrop error occurred: Local: Broker transport failure (transport)
416
- ```
417
-
418
452
  ### Forking and potential memory problems
419
453
 
420
454
  If you work with forked processes, make sure you **don't** use the producer before the fork. You can easily configure the producer and then fork and use it.
@@ -25,6 +25,7 @@ module WaterDrop
25
25
 
26
26
  @monitor.instrument(
27
27
  'error.occurred',
28
+ caller: self,
28
29
  error: error,
29
30
  producer_id: @producer_id,
30
31
  type: 'librdkafka.error'
@@ -82,7 +82,6 @@ module WaterDrop
82
82
  # @param event [Dry::Events::Event] event that happened with the details
83
83
  def on_producer_closed(event)
84
84
  info event, 'Closing producer'
85
- debug event, ''
86
85
  end
87
86
 
88
87
  # @param event [Dry::Events::Event] event that happened with the error details
@@ -91,7 +90,6 @@ module WaterDrop
91
90
  type = event[:type]
92
91
 
93
92
  error(event, "Error occurred: #{error} - #{type}")
94
- debug(event, '')
95
93
  end
96
94
 
97
95
  private
@@ -110,6 +110,7 @@ module WaterDrop
110
110
  rescue *RESCUED_ERRORS => e
111
111
  @monitor.instrument(
112
112
  'error.occurred',
113
+ caller: self,
113
114
  error: e,
114
115
  producer_id: id,
115
116
  dispatched: dispatched,
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.4.8'
6
+ VERSION = '2.4.10'
7
7
  end
data/waterdrop.gemspec CHANGED
@@ -16,11 +16,9 @@ Gem::Specification.new do |spec|
16
16
  spec.description = spec.summary
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.add_dependency 'karafka-core', '>= 2.0.8', '< 3.0.0'
19
+ spec.add_dependency 'karafka-core', '>= 2.0.9', '< 3.0.0'
20
20
  spec.add_dependency 'zeitwerk', '~> 2.3'
21
21
 
22
- spec.required_ruby_version = '>= 2.7'
23
-
24
22
  if $PROGRAM_NAME.end_with?('gem')
25
23
  spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
26
24
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waterdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-01-07 00:00:00.000000000 Z
38
+ date: 2023-01-30 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.8
46
+ version: 2.0.9
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.0.0
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 2.0.8
56
+ version: 2.0.9
57
57
  - - "<"
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.0.0
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '2.7'
138
+ version: '0'
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - ">="
metadata.gz.sig CHANGED
Binary file