waterdrop 2.4.0 → 2.4.2
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 +6 -0
- data/Gemfile.lock +9 -8
- data/certs/cert_chain.pem +26 -0
- data/lib/waterdrop/config.rb +1 -1
- data/lib/waterdrop/contracts/message.rb +3 -2
- data/lib/waterdrop/instrumentation/callbacks/statistics.rb +1 -1
- data/lib/waterdrop/instrumentation/vendors/datadog/listener.rb +7 -7
- data/lib/waterdrop/version.rb +1 -1
- data/waterdrop.gemspec +3 -3
- data.tar.gz.sig +0 -0
- metadata +38 -32
- metadata.gz.sig +0 -0
- data/certs/mensfeld.pem +0 -25
- data/lib/waterdrop/instrumentation/callbacks/statistics_decorator.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba9d9c3c27b55980d16b4bca8266ec70864e53fc00e8f9823bc6407704105638
|
4
|
+
data.tar.gz: '017907f6d33941b52bb8943befe6981586083de52739cf12937ceae3dececd79'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d60772d7a278eed00a63ee08690a3897c45d55a74f2dd796353f528f8b6ae0ec93a8f79c8b6c717ad3435f9f3661b811ba278cd35355a2079b0194a6dc56c6
|
7
|
+
data.tar.gz: 721694ab354d11419dc21f2911cbea57f4d89160067ec6b69687741471f498535779e4ee43ece02ac7697a070dfc3d5c6dc2d9119b811fd4b84ecb9703ad89a2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# WaterDrop changelog
|
2
2
|
|
3
|
+
## 2.4.2 (2022-09-29)
|
4
|
+
- Allow sending tombstone messages (#267)
|
5
|
+
|
6
|
+
## 2.4.1 (2022-08-01)
|
7
|
+
- Replace local statistics decorator with the one extracted to `karafka-core`.
|
8
|
+
|
3
9
|
## 2.4.0 (2022-07-28)
|
4
10
|
- Small refactor of the DataDog/Statsd listener to align for future extraction to `karafka-common`.
|
5
11
|
- Replace `dry-monitor` with home-brew notification layer (API compatible) and allow for usage with `ActiveSupport::Notifications`.
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
waterdrop (2.4.
|
5
|
-
karafka-core (
|
4
|
+
waterdrop (2.4.2)
|
5
|
+
karafka-core (>= 2.0.2, < 3.0.0)
|
6
6
|
rdkafka (>= 0.10)
|
7
7
|
zeitwerk (~> 2.3)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.0.
|
12
|
+
activesupport (7.0.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
@@ -23,10 +23,10 @@ GEM
|
|
23
23
|
ffi (1.15.5)
|
24
24
|
i18n (1.12.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
|
-
karafka-core (2.0.
|
26
|
+
karafka-core (2.0.2)
|
27
27
|
concurrent-ruby (>= 1.1)
|
28
28
|
mini_portile2 (2.8.0)
|
29
|
-
minitest (5.16.
|
29
|
+
minitest (5.16.3)
|
30
30
|
rake (13.0.6)
|
31
31
|
rdkafka (0.12.0)
|
32
32
|
ffi (~> 1.15)
|
@@ -38,13 +38,13 @@ GEM
|
|
38
38
|
rspec-mocks (~> 3.11.0)
|
39
39
|
rspec-core (3.11.0)
|
40
40
|
rspec-support (~> 3.11.0)
|
41
|
-
rspec-expectations (3.11.
|
41
|
+
rspec-expectations (3.11.1)
|
42
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
43
|
rspec-support (~> 3.11.0)
|
44
44
|
rspec-mocks (3.11.1)
|
45
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
46
|
rspec-support (~> 3.11.0)
|
47
|
-
rspec-support (3.11.
|
47
|
+
rspec-support (3.11.1)
|
48
48
|
simplecov (0.21.2)
|
49
49
|
docile (~> 1.1)
|
50
50
|
simplecov-html (~> 0.11)
|
@@ -56,6 +56,7 @@ GEM
|
|
56
56
|
zeitwerk (2.6.0)
|
57
57
|
|
58
58
|
PLATFORMS
|
59
|
+
arm64-darwin
|
59
60
|
x86_64-linux
|
60
61
|
|
61
62
|
DEPENDENCIES
|
@@ -66,4 +67,4 @@ DEPENDENCIES
|
|
66
67
|
waterdrop!
|
67
68
|
|
68
69
|
BUNDLED WITH
|
69
|
-
2.3.
|
70
|
+
2.3.22
|
@@ -0,0 +1,26 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MRAwDgYDVQQDDAdjb250
|
3
|
+
YWN0MRcwFQYKCZImiZPyLGQBGRYHa2FyYWZrYTESMBAGCgmSJomT8ixkARkWAmlv
|
4
|
+
MB4XDTIyMDgxOTE3MjEzN1oXDTIzMDgxOTE3MjEzN1owPzEQMA4GA1UEAwwHY29u
|
5
|
+
dGFjdDEXMBUGCgmSJomT8ixkARkWB2thcmFma2ExEjAQBgoJkiaJk/IsZAEZFgJp
|
6
|
+
bzCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAODzeO3L6lxdATzMHKNW
|
7
|
+
jFA/GGunoPuylO/BMzy8RiQHh7VIvysAKs0tHhTx3g2D0STDpF+hcQcPELFikiT2
|
8
|
+
F+1wOHj/SsrK7VKqfA8+gq04hKc5sQoX2Egf9k3V0YJ3eZ6R/koHkQ8A0TVt0w6F
|
9
|
+
ZQckoV4MqnEAx0g/FZN3mnHTlJ3VFLSBqJEIe+S6FZMl92mSv+hTrlUG8VaYxSfN
|
10
|
+
lTCvnKk284F6QZq5XIENLRmcDd/3aPBL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U0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
|
26
|
+
-----END CERTIFICATE-----
|
data/lib/waterdrop/config.rb
CHANGED
@@ -77,7 +77,7 @@ module WaterDrop
|
|
77
77
|
# Propagates the kafka setting defaults unless they are already present
|
78
78
|
# This makes it easier to set some values that users usually don't change but still allows them
|
79
79
|
# to overwrite the whole hash if they want to
|
80
|
-
# @param config [
|
80
|
+
# @param config [Karafka::Core::Configurable::Node] config of this producer
|
81
81
|
def merge_kafka_defaults!(config)
|
82
82
|
KAFKA_DEFAULTS.each do |key, value|
|
83
83
|
next if config.kafka.key?(key)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module WaterDrop
|
4
4
|
module Contracts
|
5
5
|
# Contract with validation rules for validating that all the message options that
|
6
|
-
# we provide to producer
|
6
|
+
# we provide to producer are valid and usable
|
7
7
|
class Message < ::Karafka::Core::Contractable::Contract
|
8
8
|
configure do |config|
|
9
9
|
config.error_messages = YAML.safe_load(
|
@@ -27,7 +27,7 @@ module WaterDrop
|
|
27
27
|
end
|
28
28
|
|
29
29
|
required(:topic) { |val| val.is_a?(String) && TOPIC_REGEXP.match?(val) }
|
30
|
-
required(:payload) { |val| val.is_a?(String) }
|
30
|
+
required(:payload) { |val| val.nil? || val.is_a?(String) }
|
31
31
|
optional(:key) { |val| val.nil? || (val.is_a?(String) && !val.empty?) }
|
32
32
|
optional(:partition) { |val| val.is_a?(Integer) && val >= -1 }
|
33
33
|
optional(:partition_key) { |val| val.nil? || (val.is_a?(String) && !val.empty?) }
|
@@ -51,6 +51,7 @@ module WaterDrop
|
|
51
51
|
|
52
52
|
virtual do |config, errors, validator|
|
53
53
|
next true unless errors.empty?
|
54
|
+
next if config[:payload].nil? # tombstone payload
|
54
55
|
next true if config[:payload].bytesize <= validator.max_payload_size
|
55
56
|
|
56
57
|
[[%i[payload], :max_size]]
|
@@ -17,7 +17,7 @@ module WaterDrop
|
|
17
17
|
@producer_id = producer_id
|
18
18
|
@client_name = client_name
|
19
19
|
@monitor = monitor
|
20
|
-
@statistics_decorator = StatisticsDecorator.new
|
20
|
+
@statistics_decorator = ::Karafka::Core::Monitoring::StatisticsDecorator.new
|
21
21
|
end
|
22
22
|
|
23
23
|
# Emits decorated statistics to the monitor
|
@@ -66,7 +66,7 @@ module WaterDrop
|
|
66
66
|
|
67
67
|
# Hooks up to WaterDrop instrumentation for emitted statistics
|
68
68
|
#
|
69
|
-
# @param event [
|
69
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
70
70
|
def on_statistics_emitted(event)
|
71
71
|
statistics = event[:statistics]
|
72
72
|
|
@@ -77,13 +77,13 @@ module WaterDrop
|
|
77
77
|
|
78
78
|
# Increases the errors count by 1
|
79
79
|
#
|
80
|
-
# @param _event [
|
80
|
+
# @param _event [Karafka::Core::Monitoring::Event]
|
81
81
|
def on_error_occurred(_event)
|
82
82
|
count('error_occurred', 1, tags: default_tags)
|
83
83
|
end
|
84
84
|
|
85
85
|
# Increases acknowledged messages counter
|
86
|
-
# @param _event [
|
86
|
+
# @param _event [Karafka::Core::Monitoring::Event]
|
87
87
|
def on_message_acknowledged(_event)
|
88
88
|
increment('acknowledged', tags: default_tags)
|
89
89
|
end
|
@@ -93,12 +93,12 @@ module WaterDrop
|
|
93
93
|
produced_async
|
94
94
|
].each do |event_scope|
|
95
95
|
class_eval <<~METHODS, __FILE__, __LINE__ + 1
|
96
|
-
# @param event [
|
96
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
97
97
|
def on_message_#{event_scope}(event)
|
98
98
|
report_message(event[:message][:topic], :#{event_scope})
|
99
99
|
end
|
100
100
|
|
101
|
-
# @param event [
|
101
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
102
102
|
def on_messages_#{event_scope}(event)
|
103
103
|
event[:messages].each do |message|
|
104
104
|
report_message(message[:topic], :#{event_scope})
|
@@ -113,7 +113,7 @@ module WaterDrop
|
|
113
113
|
messages_buffered
|
114
114
|
].each do |event_scope|
|
115
115
|
class_eval <<~METHODS, __FILE__, __LINE__ + 1
|
116
|
-
# @param event [
|
116
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
117
117
|
def on_#{event_scope}(event)
|
118
118
|
histogram(
|
119
119
|
'buffer.size',
|
@@ -131,7 +131,7 @@ module WaterDrop
|
|
131
131
|
flushed_async
|
132
132
|
].each do |event_scope|
|
133
133
|
class_eval <<~METHODS, __FILE__, __LINE__ + 1
|
134
|
-
# @param event [
|
134
|
+
# @param event [Karafka::Core::Monitoring::Event]
|
135
135
|
def on_buffer_#{event_scope}(event)
|
136
136
|
event[:messages].each do |message|
|
137
137
|
report_message(message[:topic], :#{event_scope})
|
data/lib/waterdrop/version.rb
CHANGED
data/waterdrop.gemspec
CHANGED
@@ -10,13 +10,13 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.version = ::WaterDrop::VERSION
|
11
11
|
spec.platform = Gem::Platform::RUBY
|
12
12
|
spec.authors = ['Maciej Mensfeld']
|
13
|
-
spec.email = %w[
|
13
|
+
spec.email = %w[contact@karafka.io]
|
14
14
|
spec.homepage = 'https://karafka.io'
|
15
15
|
spec.summary = 'Kafka messaging made easy!'
|
16
16
|
spec.description = spec.summary
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
|
-
spec.add_dependency 'karafka-core', '
|
19
|
+
spec.add_dependency 'karafka-core', '>= 2.0.2', '< 3.0.0'
|
20
20
|
spec.add_dependency 'rdkafka', '>= 0.10'
|
21
21
|
spec.add_dependency 'zeitwerk', '~> 2.3'
|
22
22
|
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
27
27
|
end
|
28
28
|
|
29
|
-
spec.cert_chain = %w[certs/
|
29
|
+
spec.cert_chain = %w[certs/cert_chain.pem]
|
30
30
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
31
31
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = %w[lib]
|
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.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -10,46 +10,53 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
/
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MRAwDgYDVQQDDAdjb250
|
14
|
+
YWN0MRcwFQYKCZImiZPyLGQBGRYHa2FyYWZrYTESMBAGCgmSJomT8ixkARkWAmlv
|
15
|
+
MB4XDTIyMDgxOTE3MjEzN1oXDTIzMDgxOTE3MjEzN1owPzEQMA4GA1UEAwwHY29u
|
16
|
+
dGFjdDEXMBUGCgmSJomT8ixkARkWB2thcmFma2ExEjAQBgoJkiaJk/IsZAEZFgJp
|
17
|
+
bzCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAODzeO3L6lxdATzMHKNW
|
18
|
+
jFA/GGunoPuylO/BMzy8RiQHh7VIvysAKs0tHhTx3g2D0STDpF+hcQcPELFikiT2
|
19
|
+
F+1wOHj/SsrK7VKqfA8+gq04hKc5sQoX2Egf9k3V0YJ3eZ6R/koHkQ8A0TVt0w6F
|
20
|
+
ZQckoV4MqnEAx0g/FZN3mnHTlJ3VFLSBq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f04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
|
36
|
+
MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
|
36
37
|
-----END CERTIFICATE-----
|
37
|
-
date: 2022-
|
38
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
38
39
|
dependencies:
|
39
40
|
- !ruby/object:Gem::Dependency
|
40
41
|
name: karafka-core
|
41
42
|
requirement: !ruby/object:Gem::Requirement
|
42
43
|
requirements:
|
43
|
-
- - "
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.2
|
47
|
+
- - "<"
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
49
|
+
version: 3.0.0
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
|
-
- - "
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.0.2
|
57
|
+
- - "<"
|
51
58
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
59
|
+
version: 3.0.0
|
53
60
|
- !ruby/object:Gem::Dependency
|
54
61
|
name: rdkafka
|
55
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +87,7 @@ dependencies:
|
|
80
87
|
version: '2.3'
|
81
88
|
description: Kafka messaging made easy!
|
82
89
|
email:
|
83
|
-
-
|
90
|
+
- contact@karafka.io
|
84
91
|
executables: []
|
85
92
|
extensions: []
|
86
93
|
extra_rdoc_files: []
|
@@ -97,7 +104,7 @@ files:
|
|
97
104
|
- Gemfile.lock
|
98
105
|
- MIT-LICENSE
|
99
106
|
- README.md
|
100
|
-
- certs/
|
107
|
+
- certs/cert_chain.pem
|
101
108
|
- config/errors.yml
|
102
109
|
- docker-compose.yml
|
103
110
|
- lib/waterdrop.rb
|
@@ -110,7 +117,6 @@ files:
|
|
110
117
|
- lib/waterdrop/instrumentation/callbacks/delivery.rb
|
111
118
|
- lib/waterdrop/instrumentation/callbacks/error.rb
|
112
119
|
- lib/waterdrop/instrumentation/callbacks/statistics.rb
|
113
|
-
- lib/waterdrop/instrumentation/callbacks/statistics_decorator.rb
|
114
120
|
- lib/waterdrop/instrumentation/callbacks_manager.rb
|
115
121
|
- lib/waterdrop/instrumentation/logger_listener.rb
|
116
122
|
- lib/waterdrop/instrumentation/monitor.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/certs/mensfeld.pem
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
3
|
-
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjEwODExMTQxNTEzWhcNMjIwODExMTQx
|
4
|
-
NTEzWjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
5
|
-
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDV2jKH4Ti87GM6nyT6D+ESzTI0MZDj
|
6
|
-
ak2/TEwnxvijMJyCCPKT/qIkbW4/f0VHM4rhPr1nW73sb5SZBVFCLlJcOSKOBdUY
|
7
|
-
TMY+SIXN2EtUaZuhAOe8LxtxjHTgRHvHcqUQMBENXTISNzCo32LnUxweu66ia4Pd
|
8
|
-
1mNRhzOqNv9YiBZvtBf7IMQ+sYdOCjboq2dlsWmJiwiDpY9lQBTnWORnT3mQxU5x
|
9
|
-
vPSwnLB854cHdCS8fQo4DjeJBRZHhEbcE5sqhEMB3RZA3EtFVEXOxlNxVTS3tncI
|
10
|
-
qyNXiWDaxcipaens4ObSY1C2HTV7OWb7OMqSCIybeYTSfkaSdqmcl4S6zxXkjH1J
|
11
|
-
tnjayAVzD+QVXGijsPLE2PFnJAh9iDET2cMsjabO1f6l1OQNyAtqpcyQcgfnyW0z
|
12
|
-
g7tGxTYD+6wJHffM9d9txOUw6djkF6bDxyqB8lo4Z3IObCx18AZjI9XPS9QG7w6q
|
13
|
-
LCWuMG2lkCcRgASqaVk9fEf9yMc2xxz5o3kCAwEAAaN3MHUwCQYDVR0TBAIwADAL
|
14
|
-
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFBqUFCKCOe5IuueUVqOB991jyCLLMB0GA1Ud
|
15
|
-
EQQWMBSBEm1hY2llakBtZW5zZmVsZC5wbDAdBgNVHRIEFjAUgRJtYWNpZWpAbWVu
|
16
|
-
c2ZlbGQucGwwDQYJKoZIhvcNAQELBQADggGBADD0/UuTTFgW+CGk2U0RDw2RBOca
|
17
|
-
W2LTF/G7AOzuzD0Tc4voc7WXyrgKwJREv8rgBimLnNlgmFJLmtUCh2U/MgxvcilH
|
18
|
-
yshYcbseNvjkrtYnLRlWZR4SSB6Zei5AlyGVQLPkvdsBpNegcG6w075YEwzX/38a
|
19
|
-
8V9B/Yri2OGELBz8ykl7BsXUgNoUPA/4pHF6YRLz+VirOaUIQ4JfY7xGj6fSOWWz
|
20
|
-
/rQ/d77r6o1mfJYM/3BRVg73a3b7DmRnE5qjwmSaSQ7u802pJnLesmArch0xGCT/
|
21
|
-
fMmRli1Qb+6qOTl9mzD6UDMAyFR4t6MStLm0mIEqM0nBO5nUdUWbC7l9qXEf8XBE
|
22
|
-
2DP28p3EqSuS+lKbAWKcqv7t0iRhhmaod+Yn9mcrLN1sa3q3KSQ9BCyxezCD4Mk2
|
23
|
-
R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
|
24
|
-
pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
|
25
|
-
-----END CERTIFICATE-----
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module WaterDrop
|
4
|
-
module Instrumentation
|
5
|
-
module Callbacks
|
6
|
-
# Many of the librdkafka statistics are absolute values instead of a gauge.
|
7
|
-
# This means, that for example number of messages sent is an absolute growing value
|
8
|
-
# instead of being a value of messages sent from the last statistics report.
|
9
|
-
# This decorator calculates the diff against previously emited stats, so we get also
|
10
|
-
# the diff together with the original values
|
11
|
-
class StatisticsDecorator
|
12
|
-
def initialize
|
13
|
-
@previous = {}.freeze
|
14
|
-
end
|
15
|
-
|
16
|
-
# @param emited_stats [Hash] original emited statistics
|
17
|
-
# @return [Hash] emited statistics extended with the diff data
|
18
|
-
# @note We modify the emited statistics, instead of creating new. Since we don't expose
|
19
|
-
# any API to get raw data, users can just assume that the result of this decoration is
|
20
|
-
# the proper raw stats that they can use
|
21
|
-
def call(emited_stats)
|
22
|
-
diff(
|
23
|
-
@previous,
|
24
|
-
emited_stats
|
25
|
-
)
|
26
|
-
|
27
|
-
@previous = emited_stats
|
28
|
-
|
29
|
-
emited_stats.freeze
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
# Calculates the diff of the provided values and modifies in place the emited statistics
|
35
|
-
#
|
36
|
-
# @param previous [Object] previous value from the given scope in which
|
37
|
-
# we are
|
38
|
-
# @param current [Object] current scope from emitted statistics
|
39
|
-
# @return [Object] the diff if the values were numerics or the current scope
|
40
|
-
def diff(previous, current)
|
41
|
-
if current.is_a?(Hash)
|
42
|
-
# @note We cannot use #each_key as we modify the content of the current scope
|
43
|
-
# in place (in case it's a hash)
|
44
|
-
current.keys.each do |key|
|
45
|
-
append(
|
46
|
-
current,
|
47
|
-
key,
|
48
|
-
diff((previous || {})[key], (current || {})[key])
|
49
|
-
)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# Diff can be computed only for numerics
|
54
|
-
return current unless current.is_a?(Numeric)
|
55
|
-
# If there was no previous value, delta is always zero
|
56
|
-
return 0 unless previous
|
57
|
-
# Should never happen but just in case, a type changed in between stats
|
58
|
-
return current unless previous.is_a?(Numeric)
|
59
|
-
|
60
|
-
current - previous
|
61
|
-
end
|
62
|
-
|
63
|
-
# Appends the result of the diff to a given key as long as the result is numeric
|
64
|
-
#
|
65
|
-
# @param current [Hash] current scope
|
66
|
-
# @param key [Symbol] key based on which we were diffing
|
67
|
-
# @param result [Object] diff result
|
68
|
-
def append(current, key, result)
|
69
|
-
return unless result.is_a?(Numeric)
|
70
|
-
return if current.frozen?
|
71
|
-
|
72
|
-
current["#{key}_d"] = result
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|