waterdrop 2.6.13 → 2.6.14

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: '06984e8584d8b1ed3e6f854be6ca1cd1957acab63d6640c41087a42572da670a'
4
- data.tar.gz: 9b0c94f047b5e21a554ecad5f32639a761aa32fbab9f5776a2470fdfe4adb675
3
+ metadata.gz: 24dc1ffc8d6298980ec8f0c302141a643196acbf62da017cf03ec6675552532c
4
+ data.tar.gz: '08b66f7abb7f2e04fb9a9b5da566f5cefb5a00769ef14c14898f86c07003f81e'
5
5
  SHA512:
6
- metadata.gz: 610ec69f42c6d209e3d024825d62ecd25e7d50ad212d14b4b2db7534463f63e5cee4662b0412db559d1537fa28ef76acd3b22418f686fcea6c6406a1cb6cec54
7
- data.tar.gz: af35df96c8566d1fef3d16898553277c3d15a572ab8fc563858048beae70915a761109a32cd101b22123174f16dc601f7f28c2699fae20126d5dd9dc519fcd23
6
+ metadata.gz: 65d1a0b2ce58fa07edfa96dffaa97773424a53787ee05ba981ca1ed9e4edb91d7f9b25e4dbc5e054ac68abf288dd5e1a879cb09ee13fcacc9422d9a341f4bd81
7
+ data.tar.gz: 2c7ce204ab9c9af43c5e916143aa5375e45157f1fd9c34acf69dc3191a646c3d41c230af82f6d1b8047836f2b7d4437d9a2cf3c173cd8beb9a7c1948c652cd54
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.6.14 (2024-02-06)
4
+ - [Enhancement] Instrument `producer.connected` and `producer.closing` lifecycle events.
5
+
3
6
  ## 2.6.13 (2024-01-29)
4
7
  - [Enhancement] Expose `#partition_count` for building custom partitioners that need to be aware of number of partitions on a given topic.
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.6.13)
4
+ waterdrop (2.6.14)
5
5
  karafka-core (>= 2.2.3, < 3.0.0)
6
6
  zeitwerk (~> 2.3)
7
7
 
@@ -23,7 +23,7 @@ GEM
23
23
  byebug (11.1.3)
24
24
  concurrent-ruby (1.2.3)
25
25
  connection_pool (2.4.1)
26
- diff-lcs (1.5.0)
26
+ diff-lcs (1.5.1)
27
27
  docile (1.4.0)
28
28
  drb (2.2.0)
29
29
  ruby2_keywords
@@ -43,19 +43,19 @@ GEM
43
43
  minitest (5.21.2)
44
44
  mutex_m (0.2.0)
45
45
  rake (13.1.0)
46
- rspec (3.12.0)
47
- rspec-core (~> 3.12.0)
48
- rspec-expectations (~> 3.12.0)
49
- rspec-mocks (~> 3.12.0)
50
- rspec-core (3.12.2)
51
- rspec-support (~> 3.12.0)
52
- rspec-expectations (3.12.3)
46
+ rspec (3.13.0)
47
+ rspec-core (~> 3.13.0)
48
+ rspec-expectations (~> 3.13.0)
49
+ rspec-mocks (~> 3.13.0)
50
+ rspec-core (3.13.0)
51
+ rspec-support (~> 3.13.0)
52
+ rspec-expectations (3.13.0)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.12.0)
55
- rspec-mocks (3.12.6)
54
+ rspec-support (~> 3.13.0)
55
+ rspec-mocks (3.13.0)
56
56
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.12.0)
58
- rspec-support (3.12.1)
57
+ rspec-support (~> 3.13.0)
58
+ rspec-support (3.13.0)
59
59
  ruby2_keywords (0.0.5)
60
60
  simplecov (0.22.0)
61
61
  docile (~> 1.1)
@@ -118,6 +118,13 @@ module WaterDrop
118
118
  end
119
119
 
120
120
  # @param event [Dry::Events::Event] event that happened with the details
121
+ def on_producer_closing(event)
122
+ info(event, 'Closing producer')
123
+ end
124
+
125
+ # @param event [Dry::Events::Event] event that happened with the details
126
+ # @note While this says "Closing producer", it produces a nice message with time taken:
127
+ # "Closing producer took 12 ms" indicating it happened in the past.
121
128
  def on_producer_closed(event)
122
129
  info(event, 'Closing producer')
123
130
  end
@@ -180,7 +187,11 @@ module WaterDrop
180
187
  # @param event [Dry::Events::Event] event that happened with the details
181
188
  # @param log_message [String] message we want to publish
182
189
  def info(event, log_message)
183
- @logger.info("[#{event[:producer_id]}] #{log_message} took #{event[:time]} ms")
190
+ if event.payload.key?(:time)
191
+ @logger.info("[#{event[:producer_id]}] #{log_message} took #{event[:time]} ms")
192
+ else
193
+ @logger.info("[#{event[:producer_id]}] #{log_message}")
194
+ end
184
195
  end
185
196
 
186
197
  # @param event [Dry::Events::Event] event that happened with the details
@@ -7,6 +7,8 @@ module WaterDrop
7
7
  # List of events that we support in the system and to which a monitor client can hook up
8
8
  # @note The non-error once support timestamp benchmarking
9
9
  EVENTS = %w[
10
+ producer.connected
11
+ producer.closing
10
12
  producer.closed
11
13
 
12
14
  message.produced_async
@@ -117,6 +117,7 @@ module WaterDrop
117
117
  )
118
118
 
119
119
  @status.connected!
120
+ @monitor.instrument('producer.connected', producer_id: id)
120
121
  end
121
122
 
122
123
  @client
@@ -125,9 +126,10 @@ module WaterDrop
125
126
  # Fetches and caches the partition count of a topic
126
127
  #
127
128
  # @param topic [String] topic for which we want to get the number of partitions
128
- # @return [Integer] number of partitions of the requested topic
129
+ # @return [Integer] number of partitions of the requested topic or -1 if number could not be
130
+ # retrieved.
129
131
  #
130
- # @note It uses the underlying `rdkafka-ruby` partition count cache.
132
+ # @note It uses the underlying `rdkafka-ruby` partition count fetch and cache.
131
133
  def partition_count(topic)
132
134
  client.partition_count(topic.to_s)
133
135
  end
@@ -159,6 +161,7 @@ module WaterDrop
159
161
  producer_id: id
160
162
  ) do
161
163
  @status.closing!
164
+ @monitor.instrument('producer.closing', producer_id: id)
162
165
 
163
166
  # No need for auto-gc if everything got closed by us
164
167
  # This should be used only in case a producer was not closed properly and forgotten
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.6.13'
6
+ VERSION = '2.6.14'
7
7
  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.6.13
4
+ version: 2.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
36
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
37
  -----END CERTIFICATE-----
38
- date: 2024-01-29 00:00:00.000000000 Z
38
+ date: 2024-02-06 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
metadata.gz.sig CHANGED
Binary file