waterdrop 2.0.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +33 -6
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +80 -0
  6. data/Gemfile +0 -2
  7. data/Gemfile.lock +36 -87
  8. data/MIT-LICENSE +18 -0
  9. data/README.md +180 -46
  10. data/certs/mensfeld.pem +21 -21
  11. data/config/errors.yml +29 -5
  12. data/docker-compose.yml +2 -1
  13. data/lib/{water_drop → waterdrop}/config.rb +47 -19
  14. data/lib/waterdrop/contracts/config.rb +40 -0
  15. data/lib/waterdrop/contracts/message.rb +60 -0
  16. data/lib/waterdrop/instrumentation/callbacks/delivery.rb +30 -0
  17. data/lib/waterdrop/instrumentation/callbacks/error.rb +36 -0
  18. data/lib/waterdrop/instrumentation/callbacks/statistics.rb +41 -0
  19. data/lib/waterdrop/instrumentation/callbacks/statistics_decorator.rb +77 -0
  20. data/lib/waterdrop/instrumentation/callbacks_manager.rb +39 -0
  21. data/lib/{water_drop/instrumentation/stdout_listener.rb → waterdrop/instrumentation/logger_listener.rb} +17 -26
  22. data/lib/waterdrop/instrumentation/monitor.rb +20 -0
  23. data/lib/{water_drop/instrumentation/monitor.rb → waterdrop/instrumentation/notifications.rb} +12 -13
  24. data/lib/waterdrop/instrumentation/vendors/datadog/dashboard.json +1 -0
  25. data/lib/waterdrop/instrumentation/vendors/datadog/listener.rb +210 -0
  26. data/lib/waterdrop/instrumentation.rb +20 -0
  27. data/lib/waterdrop/patches/rdkafka/bindings.rb +42 -0
  28. data/lib/waterdrop/patches/rdkafka/producer.rb +28 -0
  29. data/lib/{water_drop → waterdrop}/producer/async.rb +2 -2
  30. data/lib/{water_drop → waterdrop}/producer/buffer.rb +15 -8
  31. data/lib/waterdrop/producer/builder.rb +28 -0
  32. data/lib/{water_drop → waterdrop}/producer/sync.rb +2 -2
  33. data/lib/{water_drop → waterdrop}/producer.rb +29 -15
  34. data/lib/{water_drop → waterdrop}/version.rb +1 -1
  35. data/lib/waterdrop.rb +33 -2
  36. data/waterdrop.gemspec +12 -10
  37. data.tar.gz.sig +0 -0
  38. metadata +64 -97
  39. metadata.gz.sig +0 -0
  40. data/.github/FUNDING.yml +0 -1
  41. data/LICENSE +0 -165
  42. data/lib/water_drop/contracts/config.rb +0 -26
  43. data/lib/water_drop/contracts/message.rb +0 -41
  44. data/lib/water_drop/instrumentation.rb +0 -7
  45. data/lib/water_drop/producer/builder.rb +0 -63
  46. data/lib/water_drop/producer/statistics_decorator.rb +0 -71
  47. data/lib/water_drop.rb +0 -30
  48. /data/lib/{water_drop → waterdrop}/contracts.rb +0 -0
  49. /data/lib/{water_drop → waterdrop}/errors.rb +0 -0
  50. /data/lib/{water_drop → waterdrop}/producer/dummy_client.rb +0 -0
  51. /data/lib/{water_drop → waterdrop}/producer/status.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 616222bb9061a061dbe807b3c490c04fc368b0f457dc70e27b27c5cc049b1271
4
- data.tar.gz: f6330179e3db7aea799360ca51a09fa56d9d7bbc757925bf482a901c90e4e76d
3
+ metadata.gz: 0bd7288d6c0c7a6f356f050af309899cad41e6fcf202c945229231d7058194e1
4
+ data.tar.gz: 727738b727dccf8e2d7b4eb7c3f25b1c7ed761eb958eae4ba818c7402839a6c7
5
5
  SHA512:
6
- metadata.gz: e09358bf7a02acca118f62f869f3f53bf417356e9f28f32187c578af5debfd6d602463b13082cfc79a3a12042e2e2efcedb000fd45009802bc186249dee4a6bb
7
- data.tar.gz: 81fe2d98e27704662201408c47746f8a800a955143f260afcbc2e4f3c3d44f34b5b27fbfdedb7bfe642e1fd3df966265f2e69585cc59cc3c4941005e17238079
6
+ metadata.gz: 95f69c8cd00d33e04747f1447ca9fe40de88941869925662116427b14da7f0eb0a04c7eada0e00ea6c226dd8be90484b7e97e6d34f9c7f0a11333bfede37e03c
7
+ data.tar.gz: fa43e25469180c9d9e65f31b4d79554b35c090e79d8812586d614a77acafe04bb873f24ed58f739c4523696282bef8dfa05e0fa0358ca808bfd2df038bf3d55b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,6 +1,9 @@
1
1
  name: ci
2
2
 
3
+ concurrency: ci-${{ github.ref }}
4
+
3
5
  on:
6
+ pull_request:
4
7
  push:
5
8
  schedule:
6
9
  - cron: '0 1 * * *'
@@ -8,16 +11,16 @@ on:
8
11
  jobs:
9
12
  specs:
10
13
  runs-on: ubuntu-latest
14
+ needs: diffend
11
15
  strategy:
12
16
  fail-fast: false
13
17
  matrix:
14
18
  ruby:
19
+ - '3.1'
20
+ - '3.0'
15
21
  - '2.7'
16
- - '2.6'
17
- - '2.5'
18
- - 'jruby'
19
22
  include:
20
- - ruby: '2.7'
23
+ - ruby: '3.1'
21
24
  coverage: 'true'
22
25
  steps:
23
26
  - uses: actions/checkout@v2
@@ -27,6 +30,12 @@ jobs:
27
30
  uses: ruby/setup-ruby@v1
28
31
  with:
29
32
  ruby-version: ${{matrix.ruby}}
33
+ - name: Run Kafka with docker-compose
34
+ # We need to give Kafka enough time to start and create all the needed topics, etc
35
+ # If anyone has a better idea on how to do it smart and easily, please contact me
36
+ run: |
37
+ docker-compose up -d
38
+ sleep 5
30
39
  - name: Install latest bundler
31
40
  run: |
32
41
  gem install bundler --no-document
@@ -35,12 +44,30 @@ jobs:
35
44
  run: |
36
45
  bundle config set without development
37
46
  bundle install --jobs 4 --retry 3
38
- - name: Run Kafka with docker-compose
39
- run: docker-compose up -d
40
47
  - name: Run all tests
41
48
  env:
42
49
  GITHUB_COVERAGE: ${{matrix.coverage}}
43
50
  run: bundle exec rspec
51
+
52
+ diffend:
53
+ runs-on: ubuntu-latest
54
+ strategy:
55
+ fail-fast: false
56
+ steps:
57
+ - uses: actions/checkout@v2
58
+ with:
59
+ fetch-depth: 0
60
+ - name: Set up Ruby
61
+ uses: ruby/setup-ruby@v1
62
+ with:
63
+ ruby-version: 3.1
64
+ - name: Install latest bundler
65
+ run: gem install bundler --no-document
66
+ - name: Install Diffend plugin
67
+ run: bundle plugin install diffend
68
+ - name: Bundle Secure
69
+ run: bundle secure
70
+
44
71
  coditsu:
45
72
  runs-on: ubuntu-latest
46
73
  strategy:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.1.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,85 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.4.0 (2022-07-28)
4
+ - Small refactor of the DataDog/Statsd listener to align for future extraction to `karafka-common`.
5
+ - Replace `dry-monitor` with home-brew notification layer (API compatible) and allow for usage with `ActiveSupport::Notifications`.
6
+ - Remove all the common code into `karafka-core` and add it as a dependency.
7
+
8
+ ## 2.3.3 (2022-07-18)
9
+ - Replace `dry-validation` with home-brew validation layer and drop direct dependency on `dry-validation`.
10
+ - Remove indirect dependency on dry-configurable from DataDog listener (no changes required).
11
+
12
+ ## 2.3.2 (2022-07-17)
13
+ - Replace `dry-configurable` with home-brew config and drop direct dependency on `dry-configurable`.
14
+
15
+ ## 2.3.1 (2022-06-17)
16
+ - Update rdkafka patches to align with `0.12.0` and `0.11.1` support.
17
+
18
+ ## 2.3.0 (2022-04-03)
19
+ - Rename StdoutListener to LoggerListener (#240)
20
+
21
+ ## 2.2.0 (2022-02-18)
22
+ - Add Datadog listener for metrics + errors publishing
23
+ - Add Datadog example dashboard template
24
+ - Update Readme to show Dd instrumentation usage
25
+ - Align the directory namespace convention with gem name (waterdrop => WaterDrop)
26
+ - Introduce a common base for validation contracts
27
+ - Drop CI support for ruby 2.6
28
+ - Require all `kafka` settings to have symbol keys (compatibility with Karafka 2.0 and rdkafka)
29
+
30
+ ## 2.1.0 (2022-01-03)
31
+ - Ruby 3.1 support
32
+ - Change the error notification key from `error.emitted` to `error.occurred`.
33
+ - Normalize error tracking and make all the places publish errors into the same notification endpoint (`error.occurred`).
34
+ - Start semantic versioning WaterDrop.
35
+
36
+ ## 2.0.7 (2021-12-03)
37
+ - Source code metadata url added to the gemspec
38
+ - Replace `:producer` with `:producer_id` in events and update `StdoutListener` accordingly. This change aligns all the events in terms of not publishing the whole producer object in the events.
39
+ - Add `error.emitted` into the `StdoutListener`.
40
+ - Enable `StdoutLogger` in specs for additional integration coverage.
41
+
42
+ ## 2.0.6 (2021-12-01)
43
+ - #218 - Fixes a case, where dispatch of callbacks the same moment a new producer was created could cause a concurrency issue in the manager.
44
+ - Fix some unstable specs.
45
+
46
+ ## 2.0.5 (2021-11-28)
47
+
48
+ ### Bug fixes
49
+
50
+ - Fixes an issue where multiple producers would emit stats of other producers causing the same stats to be published several times (as many times as a number of producers). This could cause invalid reporting for multi-kafka setups.
51
+ - Fixes a bug where emitted statistics would contain their first value as the first delta value for first stats emitted.
52
+ - Fixes a bug where decorated statistics would include a delta for a root field with non-numeric values.
53
+
54
+ ### Changes and features
55
+ - Introduces support for error callbacks instrumentation notifications with `error.emitted` monitor emitted key for tracking background errors that would occur on the producer (disconnects, etc).
56
+ - Removes the `:producer` key from `statistics.emitted` and replaces it with `:producer_id` not to inject whole producer into the payload
57
+ - Removes the `:producer` key from `message.acknowledged` and replaces it with `:producer_id` not to inject whole producer into the payload
58
+ - Cleanup and refactor of callbacks support to simplify the API and make it work with Rdkafka way of things.
59
+ - Introduces a callbacks manager concept that will also be within in Karafka `2.0` for both statistics and errors tracking per client.
60
+ - Sets default Kafka `client.id` to `waterdrop` when not set.
61
+ - Updates specs to always emit statistics for better test coverage.
62
+ - Adds statistics and errors integration specs running against Kafka.
63
+ - Replaces direct `RSpec.describe` reference with auto-discovery
64
+ - Patches `rdkafka` to provide functionalities that are needed for granular callback support.
65
+
66
+ ## 2.0.4 (2021-09-19)
67
+ - Update `dry-*` to the recent versions and update settings syntax to match it
68
+ - Update Zeitwerk requirement
69
+
70
+ ## 2.0.3 (2021-09-05)
71
+ - Remove rdkafka patch in favour of spec topic pre-creation
72
+ - Do not close client that was never used upon closing producer
73
+
74
+ ## 2.0.2 (2021-08-13)
75
+ - Add support for `partition_key`
76
+ - Switch license from `LGPL-3.0` to `MIT`
77
+ - Switch flushing on close to sync
78
+
79
+ ## 2.0.1 (2021-06-05)
80
+ - Remove Ruby 2.5 support and update minimum Ruby requirement to 2.6
81
+ - Fix the `finalizer references object to be finalized` warning issued with 3.0
82
+
3
83
  ## 2.0.0 (2020-12-13)
4
84
  - Redesign of the whole API (see `README.md` for the use-cases and the current API)
5
85
  - Replace `ruby-kafka` with `rdkafka`
data/Gemfile CHANGED
@@ -6,8 +6,6 @@ plugin 'diffend'
6
6
 
7
7
  gemspec
8
8
 
9
- gem 'rdkafka'
10
-
11
9
  group :development do
12
10
  gem 'byebug'
13
11
  end
data/Gemfile.lock CHANGED
@@ -1,120 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.0.0)
5
- concurrent-ruby (>= 1.1)
6
- dry-configurable (~> 0.8)
7
- dry-monitor (~> 0.3)
8
- dry-validation (~> 1.3)
9
- rdkafka (>= 0.6.0)
10
- zeitwerk (~> 2.1)
4
+ waterdrop (2.4.0)
5
+ karafka-core (~> 2.0)
6
+ rdkafka (>= 0.10)
7
+ zeitwerk (~> 2.3)
11
8
 
12
9
  GEM
13
10
  remote: https://rubygems.org/
14
11
  specs:
15
- activesupport (6.1.0)
12
+ activesupport (7.0.3.1)
16
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
14
  i18n (>= 1.6, < 2)
18
15
  minitest (>= 5.1)
19
16
  tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
21
17
  byebug (11.1.3)
22
- concurrent-ruby (1.1.7)
23
- diff-lcs (1.4.4)
24
- docile (1.3.2)
25
- dry-configurable (0.11.6)
26
- concurrent-ruby (~> 1.0)
27
- dry-core (~> 0.4, >= 0.4.7)
28
- dry-equalizer (~> 0.2)
29
- dry-container (0.7.2)
30
- concurrent-ruby (~> 1.0)
31
- dry-configurable (~> 0.1, >= 0.1.3)
32
- dry-core (0.5.0)
33
- concurrent-ruby (~> 1.0)
34
- dry-equalizer (0.3.0)
35
- dry-events (0.2.0)
36
- concurrent-ruby (~> 1.0)
37
- dry-core (~> 0.4)
38
- dry-equalizer (~> 0.2)
39
- dry-inflector (0.2.0)
40
- dry-initializer (3.0.4)
41
- dry-logic (1.0.8)
42
- concurrent-ruby (~> 1.0)
43
- dry-core (~> 0.2)
44
- dry-equalizer (~> 0.2)
45
- dry-monitor (0.3.2)
46
- dry-configurable (~> 0.5)
47
- dry-core (~> 0.4)
48
- dry-equalizer (~> 0.2)
49
- dry-events (~> 0.2)
50
- dry-schema (1.5.6)
51
- concurrent-ruby (~> 1.0)
52
- dry-configurable (~> 0.8, >= 0.8.3)
53
- dry-core (~> 0.4)
54
- dry-equalizer (~> 0.2)
55
- dry-initializer (~> 3.0)
56
- dry-logic (~> 1.0)
57
- dry-types (~> 1.4)
58
- dry-types (1.4.0)
59
- concurrent-ruby (~> 1.0)
60
- dry-container (~> 0.3)
61
- dry-core (~> 0.4, >= 0.4.4)
62
- dry-equalizer (~> 0.3)
63
- dry-inflector (~> 0.1, >= 0.1.2)
64
- dry-logic (~> 1.0, >= 1.0.2)
65
- dry-validation (1.6.0)
66
- concurrent-ruby (~> 1.0)
67
- dry-container (~> 0.7, >= 0.7.1)
68
- dry-core (~> 0.4)
69
- dry-equalizer (~> 0.2)
70
- dry-initializer (~> 3.0)
71
- dry-schema (~> 1.5, >= 1.5.2)
72
- factory_bot (6.1.0)
18
+ concurrent-ruby (1.1.10)
19
+ diff-lcs (1.5.0)
20
+ docile (1.4.0)
21
+ factory_bot (6.2.1)
73
22
  activesupport (>= 5.0.0)
74
- ffi (1.13.1)
75
- i18n (1.8.5)
23
+ ffi (1.15.5)
24
+ i18n (1.12.0)
76
25
  concurrent-ruby (~> 1.0)
77
- mini_portile2 (2.5.0)
78
- minitest (5.14.2)
79
- rake (13.0.1)
80
- rdkafka (0.8.1)
81
- ffi (~> 1.9)
82
- mini_portile2 (~> 2.1)
83
- rake (>= 12.3)
84
- rspec (3.10.0)
85
- rspec-core (~> 3.10.0)
86
- rspec-expectations (~> 3.10.0)
87
- rspec-mocks (~> 3.10.0)
88
- rspec-core (3.10.0)
89
- rspec-support (~> 3.10.0)
90
- rspec-expectations (3.10.0)
26
+ karafka-core (2.0.0)
27
+ concurrent-ruby (>= 1.1)
28
+ mini_portile2 (2.8.0)
29
+ minitest (5.16.2)
30
+ rake (13.0.6)
31
+ rdkafka (0.12.0)
32
+ ffi (~> 1.15)
33
+ mini_portile2 (~> 2.6)
34
+ rake (> 12)
35
+ rspec (3.11.0)
36
+ rspec-core (~> 3.11.0)
37
+ rspec-expectations (~> 3.11.0)
38
+ rspec-mocks (~> 3.11.0)
39
+ rspec-core (3.11.0)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-expectations (3.11.0)
91
42
  diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.10.0)
93
- rspec-mocks (3.10.0)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-mocks (3.11.1)
94
45
  diff-lcs (>= 1.2.0, < 2.0)
95
- rspec-support (~> 3.10.0)
96
- rspec-support (3.10.0)
97
- simplecov (0.20.0)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-support (3.11.0)
48
+ simplecov (0.21.2)
98
49
  docile (~> 1.1)
99
50
  simplecov-html (~> 0.11)
100
51
  simplecov_json_formatter (~> 0.1)
101
52
  simplecov-html (0.12.3)
102
- simplecov_json_formatter (0.1.2)
103
- tzinfo (2.0.3)
53
+ simplecov_json_formatter (0.1.4)
54
+ tzinfo (2.0.5)
104
55
  concurrent-ruby (~> 1.0)
105
- zeitwerk (2.4.2)
56
+ zeitwerk (2.6.0)
106
57
 
107
58
  PLATFORMS
108
- ruby
109
59
  x86_64-linux
110
60
 
111
61
  DEPENDENCIES
112
62
  byebug
113
63
  factory_bot
114
- rdkafka
115
64
  rspec
116
65
  simplecov
117
66
  waterdrop!
118
67
 
119
68
  BUNDLED WITH
120
- 2.2.0
69
+ 2.3.15
data/MIT-LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.