waterdrop 2.6.12 → 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: b69e4151ceb0d03f8ac34e05793f96e4907791c5dbdc49f5beeffa7eb02d5bcf
4
- data.tar.gz: fef1a647d06d7f7ab3f26045f1ce22e7b2b40476c31b7526198291a55d73c828
3
+ metadata.gz: 24dc1ffc8d6298980ec8f0c302141a643196acbf62da017cf03ec6675552532c
4
+ data.tar.gz: '08b66f7abb7f2e04fb9a9b5da566f5cefb5a00769ef14c14898f86c07003f81e'
5
5
  SHA512:
6
- metadata.gz: 271f3de27ae484cb95b6dbc0718bbe59119262035f130511d7ef84071b598dd3e06695f233ad9335c7e318e5da754b3ec2852b1655c23d28ee2d88d67aff901c
7
- data.tar.gz: eabff4ab9ea4c832054583d52dd83d003d27333394d8630133b08d3f46d9c11278c6bd76dd4408750f4d0c41654eb2d70d94f83fbedf2250dfa0b2538a6e8e30
6
+ metadata.gz: 65d1a0b2ce58fa07edfa96dffaa97773424a53787ee05ba981ca1ed9e4edb91d7f9b25e4dbc5e054ac68abf288dd5e1a879cb09ee13fcacc9422d9a341f4bd81
7
+ data.tar.gz: 2c7ce204ab9c9af43c5e916143aa5375e45157f1fd9c34acf69dc3191a646c3d41c230af82f6d1b8047836f2b7d4437d9a2cf3c173cd8beb9a7c1948c652cd54
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.6.14 (2024-02-06)
4
+ - [Enhancement] Instrument `producer.connected` and `producer.closing` lifecycle events.
5
+
6
+ ## 2.6.13 (2024-01-29)
7
+ - [Enhancement] Expose `#partition_count` for building custom partitioners that need to be aware of number of partitions on a given topic.
8
+
3
9
  ## 2.6.12 (2024-01-03)
4
10
  - [Enhancement] Provide ability to label message dispatches for increased observability.
5
11
  - [Enhancement] Provide ability to commit offset during the transaction with a consumer provided.
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.6.12)
4
+ waterdrop (2.6.14)
5
5
  karafka-core (>= 2.2.3, < 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.1.2)
11
+ activesupport (7.1.3)
12
12
  base64
13
13
  bigdecimal
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -19,11 +19,11 @@ GEM
19
19
  mutex_m
20
20
  tzinfo (~> 2.0)
21
21
  base64 (0.2.0)
22
- bigdecimal (3.1.5)
22
+ bigdecimal (3.1.6)
23
23
  byebug (11.1.3)
24
- concurrent-ruby (1.2.2)
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
@@ -35,27 +35,27 @@ GEM
35
35
  karafka-core (2.2.7)
36
36
  concurrent-ruby (>= 1.1)
37
37
  karafka-rdkafka (>= 0.13.9, < 0.15.0)
38
- karafka-rdkafka (0.14.6)
38
+ karafka-rdkafka (0.14.7)
39
39
  ffi (~> 1.15)
40
40
  mini_portile2 (~> 2.6)
41
41
  rake (> 12)
42
42
  mini_portile2 (2.8.5)
43
- minitest (5.20.0)
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)
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  waterdrop!
80
80
 
81
81
  BUNDLED WITH
82
- 2.5.3
82
+ 2.5.4
@@ -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,11 +117,23 @@ 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
123
124
  end
124
125
 
126
+ # Fetches and caches the partition count of a topic
127
+ #
128
+ # @param topic [String] topic for which we want to get the number of partitions
129
+ # @return [Integer] number of partitions of the requested topic or -1 if number could not be
130
+ # retrieved.
131
+ #
132
+ # @note It uses the underlying `rdkafka-ruby` partition count fetch and cache.
133
+ def partition_count(topic)
134
+ client.partition_count(topic.to_s)
135
+ end
136
+
125
137
  # Purges data from both the buffer queue as well as the librdkafka queue.
126
138
  #
127
139
  # @note This is an operation that can cause data loss. Keep that in mind. It will not only
@@ -149,6 +161,7 @@ module WaterDrop
149
161
  producer_id: id
150
162
  ) do
151
163
  @status.closing!
164
+ @monitor.instrument('producer.closing', producer_id: id)
152
165
 
153
166
  # No need for auto-gc if everything got closed by us
154
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.12'
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.12
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-03 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