waterdrop 2.6.5 → 2.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -3
- data/README.md +29 -0
- data/certs/cert_chain.pem +21 -21
- data/lib/waterdrop/instrumentation/logger_listener.rb +39 -1
- data/lib/waterdrop/producer.rb +13 -1
- data/lib/waterdrop/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +24 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 428619ede726866deb36f73ca8e6a52712be5794fc0550a6f52f42566882939f
|
4
|
+
data.tar.gz: 115dc6557cae5258798ecb74049f52bf210f96485f05f10484cc08ee1e454030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e2f1c6457bb9435e332ad2d7e280665c3d9558f83b652f5b5f69dbd137a3095b0180d366b4d6e50858da25749b2e68e52df59e3a5774f603920ed96ab056b5f
|
7
|
+
data.tar.gz: c72bd17336de7a8e7da4ca45bf37578690824d6664e0c5e18c5b41b5c6a9f6ff7793e9014e4f96b03b56eb471a12ce603496c4ad88526ebf01976ed755210a74
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# WaterDrop changelog
|
2
2
|
|
3
|
+
### 2.6.7 (2023-09-01)
|
4
|
+
- [Improvement] early flush data from `librdkafka` internal buffer before closing.
|
5
|
+
- [Maintenance] Update the signing cert as the old one expired.
|
6
|
+
|
7
|
+
### 2.6.6 (2023-08-03)
|
8
|
+
- [Improvement] Provide `log_messages` option to `LoggerListener` so the extensive messages data logging can disabled.
|
9
|
+
|
3
10
|
### 2.6.5 (2023-07-22)
|
4
11
|
- [Fix] Add cause to the errors that are passed into instrumentation (konalegi)
|
5
12
|
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
waterdrop (2.6.
|
4
|
+
waterdrop (2.6.7)
|
5
5
|
karafka-core (>= 2.1.1, < 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.
|
11
|
+
activesupport (7.0.7.2)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
mini_portile2 (~> 2.6)
|
31
31
|
rake (> 12)
|
32
32
|
mini_portile2 (2.8.2)
|
33
|
-
minitest (5.
|
33
|
+
minitest (5.19.0)
|
34
34
|
rake (13.0.6)
|
35
35
|
rspec (3.12.0)
|
36
36
|
rspec-core (~> 3.12.0)
|
data/README.md
CHANGED
@@ -339,6 +339,35 @@ Karafka [Web UI](https://karafka.io/docs/Web-UI-Getting-Started/) is a user inte
|
|
339
339
|
|
340
340
|
![Example producer errors in Karafka Web-UI](https://raw.githubusercontent.com/karafka/misc/master/printscreens/web-ui/errors-producer.png)
|
341
341
|
|
342
|
+
### Logger Listener
|
343
|
+
|
344
|
+
WaterDrop comes equipped with a `LoggerListener`, a useful feature designed to facilitate the reporting of WaterDrop's operational details directly into the assigned logger. The `LoggerListener` provides a convenient way of tracking the events and operations that occur during the usage of WaterDrop, enhancing transparency and making debugging and issue tracking easier.
|
345
|
+
|
346
|
+
However, it's important to note that this Logger Listener is not subscribed by default. This means that WaterDrop does not automatically send operation data to your logger out of the box. This design choice has been made to give users greater flexibility and control over their logging configuration.
|
347
|
+
|
348
|
+
To use this functionality, you need to manually subscribe the `LoggerListener` to WaterDrop instrumentation. Below, you will find an example demonstrating how to perform this subscription.
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
LOGGER = Logger.new($stdout)
|
352
|
+
|
353
|
+
producer = WaterDrop::Producer.new do |config|
|
354
|
+
config.kafka = { 'bootstrap.servers': 'localhost:9092' }
|
355
|
+
config.logger = LOGGER
|
356
|
+
end
|
357
|
+
|
358
|
+
producer.monitor.subscribe(
|
359
|
+
WaterDrop::Instrumentation::LoggerListener.new(
|
360
|
+
# You can use a different logger than the one assigned to WaterDrop if you want
|
361
|
+
producer.config.logger,
|
362
|
+
# If this is set to false, the produced messages details will not be sent to logs
|
363
|
+
# You may set it to false if you find the level of reporting in the debug too extensive
|
364
|
+
log_messages: true
|
365
|
+
)
|
366
|
+
)
|
367
|
+
|
368
|
+
producer.produce_sync(topic: 'my.topic', payload: 'my.message')
|
369
|
+
```
|
370
|
+
|
342
371
|
### Usage statistics
|
343
372
|
|
344
373
|
WaterDrop is configured to emit internal `librdkafka` metrics every five seconds. You can change this by setting the `kafka` `statistics.interval.ms` configuration property to a value greater of equal `0`. Emitted statistics are available after subscribing to the `statistics.emitted` publisher event. If set to `0`, metrics will not be published.
|
data/certs/cert_chain.pem
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MRAwDgYDVQQDDAdjb250
|
3
3
|
YWN0MRcwFQYKCZImiZPyLGQBGRYHa2FyYWZrYTESMBAGCgmSJomT8ixkARkWAmlv
|
4
|
-
|
4
|
+
MB4XDTIzMDgyMTA3MjU1NFoXDTI0MDgyMDA3MjU1NFowPzEQMA4GA1UEAwwHY29u
|
5
5
|
dGFjdDEXMBUGCgmSJomT8ixkARkWB2thcmFma2ExEjAQBgoJkiaJk/IsZAEZFgJp
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17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hIsARra22UN8qkkUlUj3AwTaChVKN/bPJOM2DzfU
|
20
|
+
kz9vUgLeYYFfQbZqeI6SsM7ltilRV4W8D9yNUQQvOxCFxtLOetJ00fC/E7zMUzbK
|
21
|
+
IBwYFQYsbI6XQzgAIPW6nGSYKgRhkfpmquXSNKZRIQ4V6bFrufa+DzD0bt2ZA3ah
|
22
|
+
fMmJguyb5L2Gf1zpDXzFSPMG7YQFLzwYz1zZZvOU7/UCpQsHpID/YxqDp4+Dgb+Y
|
23
|
+
qma0whX8UG/gXFV2pYWpYOfpatvahwi+A1TwPQsuZwkkhi1OyF1At3RY+hjSXyav
|
24
|
+
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
25
|
+
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
26
26
|
-----END CERTIFICATE-----
|
@@ -9,8 +9,17 @@ module WaterDrop
|
|
9
9
|
# as well as we can use it standalone
|
10
10
|
class LoggerListener
|
11
11
|
# @param logger [Object] logger we want to use
|
12
|
-
|
12
|
+
# @param log_messages [Boolean] Should we report the messages content (payload and metadata)
|
13
|
+
# with each message operation.
|
14
|
+
#
|
15
|
+
# This can be extensive, especially when producing a lot of messages. We provide this
|
16
|
+
# despite the fact that we only report payloads in debug, because Rails by default operates
|
17
|
+
# with debug level. This means, that when working with Rails in development, every single
|
18
|
+
# payload dispatched will go to logs. In majority of the cases this is extensive and simply
|
19
|
+
# floods the end user.
|
20
|
+
def initialize(logger, log_messages: true)
|
13
21
|
@logger = logger
|
22
|
+
@log_messages = log_messages
|
14
23
|
end
|
15
24
|
|
16
25
|
# @param event [Dry::Events::Event] event that happened with the details
|
@@ -18,6 +27,9 @@ module WaterDrop
|
|
18
27
|
message = event[:message]
|
19
28
|
|
20
29
|
info(event, "Async producing of a message to '#{message[:topic]}' topic")
|
30
|
+
|
31
|
+
return unless log_messages?
|
32
|
+
|
21
33
|
debug(event, message)
|
22
34
|
end
|
23
35
|
|
@@ -26,6 +38,9 @@ module WaterDrop
|
|
26
38
|
message = event[:message]
|
27
39
|
|
28
40
|
info(event, "Sync producing of a message to '#{message[:topic]}' topic")
|
41
|
+
|
42
|
+
return unless log_messages?
|
43
|
+
|
29
44
|
debug(event, message)
|
30
45
|
end
|
31
46
|
|
@@ -35,6 +50,9 @@ module WaterDrop
|
|
35
50
|
topics_count = messages.map { |message| "'#{message[:topic]}'" }.uniq.count
|
36
51
|
|
37
52
|
info(event, "Async producing of #{messages.size} messages to #{topics_count} topics")
|
53
|
+
|
54
|
+
return unless log_messages?
|
55
|
+
|
38
56
|
debug(event, messages)
|
39
57
|
end
|
40
58
|
|
@@ -44,6 +62,9 @@ module WaterDrop
|
|
44
62
|
topics_count = messages.map { |message| "'#{message[:topic]}'" }.uniq.count
|
45
63
|
|
46
64
|
info(event, "Sync producing of #{messages.size} messages to #{topics_count} topics")
|
65
|
+
|
66
|
+
return unless log_messages?
|
67
|
+
|
47
68
|
debug(event, messages)
|
48
69
|
end
|
49
70
|
|
@@ -52,6 +73,9 @@ module WaterDrop
|
|
52
73
|
message = event[:message]
|
53
74
|
|
54
75
|
info(event, "Buffering of a message to '#{message[:topic]}' topic")
|
76
|
+
|
77
|
+
return unless log_messages?
|
78
|
+
|
55
79
|
debug(event, [message])
|
56
80
|
end
|
57
81
|
|
@@ -60,6 +84,9 @@ module WaterDrop
|
|
60
84
|
messages = event[:messages]
|
61
85
|
|
62
86
|
info(event, "Buffering of #{messages.size} messages")
|
87
|
+
|
88
|
+
return unless log_messages?
|
89
|
+
|
63
90
|
debug(event, [messages, messages.size])
|
64
91
|
end
|
65
92
|
|
@@ -68,6 +95,9 @@ module WaterDrop
|
|
68
95
|
messages = event[:messages]
|
69
96
|
|
70
97
|
info(event, "Async flushing of #{messages.size} messages from the buffer")
|
98
|
+
|
99
|
+
return unless log_messages?
|
100
|
+
|
71
101
|
debug(event, messages)
|
72
102
|
end
|
73
103
|
|
@@ -76,6 +106,9 @@ module WaterDrop
|
|
76
106
|
messages = event[:messages]
|
77
107
|
|
78
108
|
info(event, "Sync flushing of #{messages.size} messages from the buffer")
|
109
|
+
|
110
|
+
return unless log_messages?
|
111
|
+
|
79
112
|
debug(event, messages)
|
80
113
|
end
|
81
114
|
|
@@ -94,6 +127,11 @@ module WaterDrop
|
|
94
127
|
|
95
128
|
private
|
96
129
|
|
130
|
+
# @return [Boolean] should we report the messages details in the debug mode.
|
131
|
+
def log_messages?
|
132
|
+
@log_messages
|
133
|
+
end
|
134
|
+
|
97
135
|
# @param event [Dry::Events::Event] event that happened with the details
|
98
136
|
# @param log_message [String] message we want to publish
|
99
137
|
def debug(event, log_message)
|
data/lib/waterdrop/producer.rb
CHANGED
@@ -149,7 +149,19 @@ module WaterDrop
|
|
149
149
|
# We also mark it as closed only if it was connected, if not, it would trigger a new
|
150
150
|
# connection that anyhow would be immediately closed
|
151
151
|
if @client
|
152
|
-
|
152
|
+
# Why do we trigger it early instead of just having `#close` do it?
|
153
|
+
# The linger.ms time will be ignored for the duration of the call,
|
154
|
+
# queued messages will be sent to the broker as soon as possible.
|
155
|
+
begin
|
156
|
+
# `max_wait_timeout` is in seconds at the moment
|
157
|
+
@client.flush(@config.max_wait_timeout * 1_000) unless @client.closed?
|
158
|
+
# We can safely ignore timeouts here because any left outstanding requests
|
159
|
+
# will anyhow force wait on close
|
160
|
+
rescue ::Rdkafka::RdkafkaError, Rdkafka::AbstractHandle::WaitTimeoutError
|
161
|
+
nil
|
162
|
+
end
|
163
|
+
|
164
|
+
@client.close
|
153
165
|
@client = nil
|
154
166
|
end
|
155
167
|
|
data/lib/waterdrop/version.rb
CHANGED
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.
|
4
|
+
version: 2.6.7
|
5
5
|
platform: ruby
|
6
6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
+
YGr1tOiaJrL6c+PNmb0F31NXMKpj/r+n15HwlTMRxQrzFcgjBlxf2XFGnPQXHhBm
|
25
|
+
kp1OFnEq4GG9sON4glRldkwzi/f/fGcZmo5fm3d+0ZdNgwIDAQABo3cwdTAJBgNV
|
26
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUPVH5+dLA80A1kJ2Uz5iGwfOa
|
27
|
+
1+swHQYDVR0RBBYwFIESY29udGFjdEBrYXJhZmthLmlvMB0GA1UdEgQWMBSBEmNv
|
28
|
+
bnRhY3RAa2FyYWZrYS5pbzANBgkqhkiG9w0BAQsFAAOCAYEAnpa0jcN7JzREHMTQ
|
29
|
+
bfZ+xcvlrzuROMY6A3zIZmQgbnoZZNuX4cMRrT1p1HuwXpxdpHPw7dDjYqWw3+1h
|
30
|
+
3mXLeMuk7amjQpYoSWU/OIZMhIsARra22UN8qkkUlUj3AwTaChVKN/bPJOM2DzfU
|
31
|
+
kz9vUgLeYYFfQbZqeI6SsM7ltilRV4W8D9yNUQQvOxCFxtLOetJ00fC/E7zMUzbK
|
32
|
+
IBwYFQYsbI6XQzgAIPW6nGSYKgRhkfpmquXSNKZRIQ4V6bFrufa+DzD0bt2ZA3ah
|
33
|
+
fMmJguyb5L2Gf1zpDXzFSPMG7YQFLzwYz1zZZvOU7/UCpQsHpID/YxqDp4+Dgb+Y
|
34
|
+
qma0whX8UG/gXFV2pYWpYOfpatvahwi+A1TwPQsuZwkkhi1OyF1At3RY+hjSXyav
|
35
|
+
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
36
|
+
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-
|
38
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: karafka-core
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.4.
|
151
|
+
rubygems_version: 3.4.19
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Kafka messaging made easy!
|
metadata.gz.sig
CHANGED
Binary file
|