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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bd7288d6c0c7a6f356f050af309899cad41e6fcf202c945229231d7058194e1
4
- data.tar.gz: 727738b727dccf8e2d7b4eb7c3f25b1c7ed761eb958eae4ba818c7402839a6c7
3
+ metadata.gz: 70b84fa09ce807d6d72679917d6c9b98a4dd15b9eb50f0ae9c556acc6f084632
4
+ data.tar.gz: 8ccffe9e5331865dc93ab4c8b4b8ace2e0c3297f164c378b7919a14e307edf70
5
5
  SHA512:
6
- metadata.gz: 95f69c8cd00d33e04747f1447ca9fe40de88941869925662116427b14da7f0eb0a04c7eada0e00ea6c226dd8be90484b7e97e6d34f9c7f0a11333bfede37e03c
7
- data.tar.gz: fa43e25469180c9d9e65f31b4d79554b35c090e79d8812586d614a77acafe04bb873f24ed58f739c4523696282bef8dfa05e0fa0358ca808bfd2df038bf3d55b
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.0)
5
- karafka-core (~> 2.0)
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.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
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.4.0'
6
+ VERSION = '2.4.1'
7
7
  end
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', '~> 2.0'
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.0
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-07-28 00:00:00.000000000 Z
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: '2.0'
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: '2.0'
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
- DT[_g4r0Z���r�-(�� d����$ ��HM��]��20��9�� D;�98@�.���\$ߝ0�Kn&�l��]��%�
2
- #9xg�j��OZ�tCp�4��ҥ��[��r�
3
- @~�5��/9 ��_'������0k��'-@G���������c�[":�jh9]����^��i]8�x'tR���z^�@�f�n��O�!��ؗ����
4
- B��$IlJ�ۺE'����,���=��>ǡ��kj�Pڪ'�[\���]��;̧��ԏ
5
- iB&U��z�1_���k���B�*�}])
1
+ A��ˣ�v=�o�*>�.C{YsbA,��aB��?#Ϻ��8\����wC�Ƈ��]%�S��Om�ȏY�u�vRmla/����L��ӥ�J�����&����Ŷ{��a�&&Be�>b����}�}HiݞL��h�����IE��
2
+ %�Z#�i��ޭ��P��%���A��%D"��۩u0lJ)��Yͦ��
3
+ }"�"�9�� B�.��?��)�)yLY3{q��7�x��-�E��fE�xmg�c��b7Ԗ&��kt�Dx7f����AYX�\R����#L_�
4
+ �*8/I���ȖskMo��?�_���A��\�V��&*>���ؼ�ң����_=�ry*�:�DCD��\�������[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