waterdrop 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +3 -3
- data/lib/waterdrop/instrumentation/callbacks/statistics.rb +1 -1
- data/lib/waterdrop/version.rb +1 -1
- data/waterdrop.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +12 -7
- metadata.gz.sig +4 -5
- 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: 70b84fa09ce807d6d72679917d6c9b98a4dd15b9eb50f0ae9c556acc6f084632
|
|
4
|
+
data.tar.gz: 8ccffe9e5331865dc93ab4c8b4b8ace2e0c3297f164c378b7919a14e307edf70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66f25845bada1a7de0f6bd100b7966f246604701f0394891bc959817f222b739a73fc674b49d288ebf3674c85e9872db37069771f347fad98eeade561373610c
|
|
7
|
+
data.tar.gz: 308eafaec616bf936517086de4bcee0efa03ed555ad91a061588b781d9214198fa67258a0d7044eae523fbba4da57fa447ddafdcf3169a234cdc4b0785151c6e
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# WaterDrop changelog
|
|
2
2
|
|
|
3
|
+
## 2.4.1 (2022-08-01)
|
|
4
|
+
- Replace local statistics decorator with the one extracted to `karafka-core`.
|
|
5
|
+
|
|
3
6
|
## 2.4.0 (2022-07-28)
|
|
4
7
|
- Small refactor of the DataDog/Statsd listener to align for future extraction to `karafka-common`.
|
|
5
8
|
- Replace `dry-monitor` with home-brew notification layer (API compatible) and allow for usage with `ActiveSupport::Notifications`.
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
waterdrop (2.4.
|
|
5
|
-
karafka-core (
|
|
4
|
+
waterdrop (2.4.1)
|
|
5
|
+
karafka-core (>= 2.0.2, < 3.0.0)
|
|
6
6
|
rdkafka (>= 0.10)
|
|
7
7
|
zeitwerk (~> 2.3)
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@ 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
29
|
minitest (5.16.2)
|
|
@@ -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
|
data/lib/waterdrop/version.rb
CHANGED
data/waterdrop.gemspec
CHANGED
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
|
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
|
|
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.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Mensfeld
|
|
@@ -34,22 +34,28 @@ cert_chain:
|
|
|
34
34
|
R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
|
|
35
35
|
pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
|
|
36
36
|
-----END CERTIFICATE-----
|
|
37
|
-
date: 2022-
|
|
37
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
|
38
38
|
dependencies:
|
|
39
39
|
- !ruby/object:Gem::Dependency
|
|
40
40
|
name: karafka-core
|
|
41
41
|
requirement: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
|
43
|
-
- - "
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 2.0.2
|
|
46
|
+
- - "<"
|
|
44
47
|
- !ruby/object:Gem::Version
|
|
45
|
-
version:
|
|
48
|
+
version: 3.0.0
|
|
46
49
|
type: :runtime
|
|
47
50
|
prerelease: false
|
|
48
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
49
52
|
requirements:
|
|
50
|
-
- - "
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: 2.0.2
|
|
56
|
+
- - "<"
|
|
51
57
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
58
|
+
version: 3.0.0
|
|
53
59
|
- !ruby/object:Gem::Dependency
|
|
54
60
|
name: rdkafka
|
|
55
61
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -110,7 +116,6 @@ files:
|
|
|
110
116
|
- lib/waterdrop/instrumentation/callbacks/delivery.rb
|
|
111
117
|
- lib/waterdrop/instrumentation/callbacks/error.rb
|
|
112
118
|
- lib/waterdrop/instrumentation/callbacks/statistics.rb
|
|
113
|
-
- lib/waterdrop/instrumentation/callbacks/statistics_decorator.rb
|
|
114
119
|
- lib/waterdrop/instrumentation/callbacks_manager.rb
|
|
115
120
|
- lib/waterdrop/instrumentation/logger_listener.rb
|
|
116
121
|
- lib/waterdrop/instrumentation/monitor.rb
|
metadata.gz.sig
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
�
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
iB&U��z�1_���k���B�*�}])
|
|
1
|
+
A��ˣ�v=�o�*>�.C{Ys�bA,��aB��?#Ϻ��8\����wC�Ƈ��]%�S��Om�ȏY�u�v�Rm�l�a/����L��ӥ�J�����&����Ŷ{��a�&&Be�>b����}�}H�iݞL��h�����IE��
|
|
2
|
+
%�Z#�i��ޭ��P��%���A��%D"��۩u0lJ)��Yͦ��
|
|
3
|
+
}"�"�9�� B�.��?��)�)yLY3{q��7�x��-�E��fE�xmg�c��b�7Ԗ&��kt�Dx�7f����AY�X�\R����#L�_�
|
|
4
|
+
�*8/I���ȖskMo��?�_���A��\�V��&*>���ؼ�ң����_=�ry*�:�D�CD��\�������[0���I �6
|
|
@@ -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
|