karafka 2.0.0.rc3 → 2.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2a60c5c750ef681042f6e0a0d61032c2b9d9e8d48fa73ec480157c7bffb4cc7
4
- data.tar.gz: c04074859408e77d236e86dcfdbe8502ba5322f6e7d8d1e236c9aa838b3e1a29
3
+ metadata.gz: 526402b906d00f844c5b25925a854bc45f5127dc8c06646f1cd1432f265dfb81
4
+ data.tar.gz: c58f6be491c4c4e82237307d37874100588c97241439788325600bea77d4254f
5
5
  SHA512:
6
- metadata.gz: 487dc8f5fb131dc8f25087ae026b40710c9859e7849b878ac42053737dd665a0147462fd6348e3e03eb87e0d6657c8f0038b02506f525ee221ee1f6d806bcf84
7
- data.tar.gz: 23a68b2d97cd5441088521c949c2a0ec23befde2fa81c9b9178ea6786a582aea5e342697d08f9a3dd1dfe1401792bcbc3e936b91c87eb740ef66beccd69b39bf
6
+ metadata.gz: '08922eef9890af84f1b444329061283f7987258200a9e338b892944a6ca061a60abed273e02acf44f91728f0ed219ec494e96c05a1155db2321e941e24c8c328'
7
+ data.tar.gz: 5b3de319f1887af51eeda3ffc5b42a86601a382a55ab30e8cc7abce0526d4471ff274b3627250d47ec9a70de763fd337a7c8eff79add2b9409c935133bbe3610
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.0.rc4 (2022-07-28)
4
+ - Remove `dry-monitor`
5
+ - Use `karafka-core`
6
+
3
7
  ## 2.0.0.rc3 (2022-07-26)
4
8
  - Fix Pro partitioner hash function may not utilize all the threads (#907).
5
9
  - Improve virtual partitions messages distribution.
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,4 @@
1
- # Contribute
1
+ # Contributing
2
2
 
3
3
  ## Introduction
4
4
 
@@ -8,11 +8,7 @@ We welcome any type of contribution, not only code. You can help with:
8
8
  - **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
9
9
  - **Marketing**: writing blog posts, howto's, printing stickers, ...
10
10
  - **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
11
- - **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
12
-
13
- ## Your First Contribution
14
-
15
- Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
11
+ - **Code**: take a look at the [open issues](https://github.com/karafka/karafka/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
16
12
 
17
13
  ## Submitting code
18
14
 
@@ -32,5 +28,5 @@ By sending a pull request to the pro components, you are agreeing to transfer th
32
28
 
33
29
  ## Questions
34
30
 
35
- If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
36
- You can also reach us at hello@karafka.opencollective.com.
31
+ If you have any questions, create an [issue](https://github.com/karafka/karafka/issues) (protip: do a quick search first to see if someone else didn't ask the same question before!).
32
+ You can also reach us at contact@karafka.io.
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.0.0.rc3)
5
- dry-monitor (~> 0.5)
4
+ karafka (2.0.0.rc4)
5
+ karafka-core (>= 2.0.0, < 3.0.0)
6
6
  rdkafka (>= 0.10)
7
7
  thor (>= 0.20)
8
- waterdrop (>= 2.3.3, < 3.0.0)
8
+ waterdrop (>= 2.4.0, < 3.0.0)
9
9
  zeitwerk (~> 2.3)
10
10
 
11
11
  GEM
@@ -23,19 +23,6 @@ GEM
23
23
  concurrent-ruby (1.1.10)
24
24
  diff-lcs (1.5.0)
25
25
  docile (1.4.0)
26
- dry-configurable (0.15.0)
27
- concurrent-ruby (~> 1.0)
28
- dry-core (~> 0.6)
29
- dry-core (0.8.0)
30
- concurrent-ruby (~> 1.0)
31
- dry-events (0.3.0)
32
- concurrent-ruby (~> 1.0)
33
- dry-core (~> 0.5, >= 0.5)
34
- dry-monitor (0.6.1)
35
- dry-configurable (~> 0.13, >= 0.13.0)
36
- dry-core (~> 0.5, >= 0.5)
37
- dry-events (~> 0.2)
38
- zeitwerk (~> 2.5)
39
26
  factory_bot (6.2.1)
40
27
  activesupport (>= 5.0.0)
41
28
  ffi (1.15.5)
@@ -43,6 +30,8 @@ GEM
43
30
  activesupport (>= 5.0)
44
31
  i18n (1.12.0)
45
32
  concurrent-ruby (~> 1.0)
33
+ karafka-core (2.0.0)
34
+ concurrent-ruby (>= 1.1)
46
35
  mini_portile2 (2.8.0)
47
36
  minitest (5.16.2)
48
37
  rake (13.0.6)
@@ -70,11 +59,10 @@ GEM
70
59
  simplecov-html (0.12.3)
71
60
  simplecov_json_formatter (0.1.4)
72
61
  thor (1.2.1)
73
- tzinfo (2.0.4)
62
+ tzinfo (2.0.5)
74
63
  concurrent-ruby (~> 1.0)
75
- waterdrop (2.3.3)
76
- concurrent-ruby (>= 1.1)
77
- dry-monitor (~> 0.5)
64
+ waterdrop (2.4.0)
65
+ karafka-core (~> 2.0)
78
66
  rdkafka (>= 0.10)
79
67
  zeitwerk (~> 2.3)
80
68
  zeitwerk (2.6.0)
data/README.md CHANGED
@@ -4,18 +4,18 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/karafka.svg)](http://badge.fury.io/rb/karafka)
5
5
  [![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
6
6
 
7
- **Note**: All of the documentation here refers to Karafka `2.0.0.rc2` or higher. If you are looking for the documentation for Karafka `1.4`, please click [here](https://github.com/karafka/wiki/tree/1.4).
7
+ **Note**: All of the documentation here refers to Karafka `2.0.0.rc3` or higher. If you are looking for the documentation for Karafka `1.4`, please click [here](https://github.com/karafka/wiki/tree/1.4).
8
8
 
9
9
  ## About Karafka
10
10
 
11
11
  Karafka is a Ruby and Rails multi-threaded efficient Kafka processing framework that:
12
12
 
13
- - Supports parallel processing in [multiple threads](Concurrency-and-multithreading) (also for a single topic partition work)
14
- - Has [ActiveJob backend](Active-Job) support (including ordered jobs)
15
- - [Automatically integrates](Integrating-with-Ruby-on-Rails-and-other-frameworks#integrating-with-ruby-on-rails=) with Ruby on Rails
16
- - Supports in-development [code reloading](Auto-reload-of-code-changes-in-development)
13
+ - Supports parallel processing in [multiple threads](https://github.com/karafka/karafka/wiki/Concurrency-and-multithreading) (also for a [single topic partition](https://github.com/karafka/karafka/wiki/Pro-Virtual-Partitions) work)
14
+ - Has [ActiveJob backend](https://github.com/karafka/karafka/wiki/Active-Job) support (including ordered jobs)
15
+ - [Automatically integrates](https://github.com/karafka/karafka/wiki/Integrating-with-Ruby-on-Rails-and-other-frameworks#integrating-with-ruby-on-rails=) with Ruby on Rails
16
+ - Supports in-development [code reloading](https://github.com/karafka/karafka/wiki/Auto-reload-of-code-changes-in-development)
17
17
  - Is powered by [librdkafka](https://github.com/edenhill/librdkafka) (the Apache Kafka C/C++ client library)
18
- - Has an out-of the box [StatsD/DataDog monitoring](Monitoring-and-logging) with a dashboard template.
18
+ - Has an out-of the box [StatsD/DataDog monitoring](https://github.com/karafka/karafka/wiki/Monitoring-and-logging) with a dashboard template.
19
19
 
20
20
  ```ruby
21
21
  # Define what topics you want to consume with which consumers in karafka.rb
@@ -42,7 +42,7 @@ Karafka **uses** threads to handle many messages simultaneously in the same proc
42
42
  If you're entirely new to the subject, you can start with our "Kafka on Rails" articles series, which will get you up and running with the terminology and basic ideas behind using Kafka:
43
43
 
44
44
  - [Kafka on Rails: Using Kafka with Ruby on Rails – Part 1 – Kafka basics and its advantages](https://mensfeld.pl/2017/11/kafka-on-rails-using-kafka-with-ruby-on-rails-part-1-kafka-basics-and-its-advantages/)
45
- - [Kafka on Rails: Using Kafka with Ruby on Rails – Part 2 – Getting started with Ruby and Kafka](https://mensfeld.pl/2018/01/kafka-on-rails-using-kafka-with-ruby-on-rails-part-2-getting-started-with-ruby-and-kafka/)
45
+ - [Kafka on Rails: Using Kafka with Ruby on Rails – Part 2 – Getting started with Rails and Kafka](https://mensfeld.pl/2018/01/kafka-on-rails-using-kafka-with-ruby-on-rails-part-2-getting-started-with-ruby-and-kafka/)
46
46
 
47
47
  If you want to get started with Kafka and Karafka as fast as possible, then the best idea is to visit our [Getting started](https://github.com/karafka/karafka/wiki/Getting-started) guides and the [example apps repository](https://github.com/karafka/example-apps).
48
48
 
@@ -55,7 +55,7 @@ We also maintain many [integration specs](https://github.com/karafka/karafka/tre
55
55
  1. Add and install Karafka:
56
56
 
57
57
  ```bash
58
- bundle add karafka -v 2.0.0.rc2
58
+ bundle add karafka -v 2.0.0.rc3
59
59
 
60
60
  bundle exec karafka install
61
61
  ```
data/karafka.gemspec CHANGED
@@ -12,17 +12,17 @@ Gem::Specification.new do |spec|
12
12
  spec.authors = ['Maciej Mensfeld']
13
13
  spec.email = %w[maciej@mensfeld.pl]
14
14
  spec.homepage = 'https://karafka.io'
15
- spec.summary = 'Efficient Kafka processing framework for Ruby and Rails '
15
+ spec.summary = 'Efficient Kafka processing framework for Ruby and Rails'
16
16
  spec.description = 'Framework used to simplify Apache Kafka based Ruby applications development'
17
17
  spec.licenses = ['LGPL-3.0', 'Commercial']
18
18
 
19
- spec.add_dependency 'dry-monitor', '~> 0.5'
19
+ spec.add_dependency 'karafka-core', '>= 2.0.0', '< 3.0.0'
20
20
  spec.add_dependency 'rdkafka', '>= 0.10'
21
21
  spec.add_dependency 'thor', '>= 0.20'
22
- spec.add_dependency 'waterdrop', '>= 2.3.3', '< 3.0.0'
22
+ spec.add_dependency 'waterdrop', '>= 2.4.0', '< 3.0.0'
23
23
  spec.add_dependency 'zeitwerk', '~> 2.3'
24
24
 
25
- spec.required_ruby_version = '>= 2.6.0'
25
+ spec.required_ruby_version = '>= 2.7.0'
26
26
 
27
27
  if $PROGRAM_NAME.end_with?('gem')
28
28
  spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
@@ -3,7 +3,7 @@
3
3
  module Karafka
4
4
  module Contracts
5
5
  # Base contract for all Karafka contracts
6
- class Base < ::WaterDrop::Contractable::Contract
6
+ class Base < ::Karafka::Core::Contractable::Contract
7
7
  # @param data [Hash] data for validation
8
8
  # @return [Boolean] true if all good
9
9
  # @raise [Errors::InvalidConfigurationError] invalid configuration error
@@ -24,9 +24,6 @@ module Karafka
24
24
  # Raised when we try to use Karafka CLI commands (except install) without a boot file
25
25
  MissingBootFileError = Class.new(BaseError)
26
26
 
27
- # Raised when want to hook up to an event that is not registered and supported
28
- UnregisteredMonitorEventError = Class.new(BaseError)
29
-
30
27
  # Raised when we've waited enough for shutting down a non-responsive process
31
28
  ForcefulShutdownError = Class.new(BaseError)
32
29
 
@@ -1,66 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Karafka
4
- # Namespace for all the things related with Karafka instrumentation process
5
4
  module Instrumentation
6
- # Monitor is used to hookup external monitoring services to monitor how Karafka works
7
- # It provides a standardized API for checking incoming messages/enqueueing etc
8
- # Since it is a pub-sub based on dry-monitor, you can use as many subscribers/loggers at the
9
- # same time, which means that you might have for example file logging and NewRelic at the same
10
- # time
11
- # @note This class acts as a singleton because we are only permitted to have single monitor
12
- # per running process (just as logger)
13
- class Monitor < Dry::Monitor::Notifications
14
- # List of events that we support in the system and to which a monitor client can hook up
15
- # @note The non-error once support timestamp benchmarking
16
- # @note Depending on Karafka extensions and additional engines, this might not be the
17
- # complete list of all the events. Please use the #available_events on fully loaded
18
- # Karafka system to determine all of the events you can use.
19
- BASE_EVENTS = %w[
20
- app.initialized
21
- app.running
22
- app.stopping
23
- app.stopped
24
-
25
- consumer.consumed
26
- consumer.revoked
27
- consumer.shutdown
28
-
29
- process.notice_signal
30
-
31
- connection.listener.before_fetch_loop
32
- connection.listener.fetch_loop
33
- connection.listener.fetch_loop.received
34
-
35
- worker.process
36
- worker.processed
37
-
38
- statistics.emitted
39
-
40
- error.occurred
41
- ].freeze
42
-
43
- private_constant :BASE_EVENTS
44
-
45
- # @return [Karafka::Instrumentation::Monitor] monitor instance for system instrumentation
46
- def initialize
47
- super(:karafka)
48
- BASE_EVENTS.each(&method(:register_event))
49
- end
50
-
51
- # Allows us to subscribe to events with a code that will be yielded upon events
52
- # @param event_name_or_listener [String, Object] name of the event we want to subscribe to
53
- # or a listener if we decide to go with object listener
54
- def subscribe(event_name_or_listener)
55
- return super unless event_name_or_listener.is_a?(String)
56
- return super if available_events.include?(event_name_or_listener)
57
-
58
- raise Errors::UnregisteredMonitorEventError, event_name_or_listener
59
- end
60
-
61
- # @return [Array<String>] names of available events to which we can subscribe
62
- def available_events
63
- __bus__.events.keys
5
+ # Karafka instrumentation monitor that we use to publish events
6
+ # By default uses our internal notifications bus but can be used with
7
+ # `ActiveSupport::Notifications` as well
8
+ class Monitor < ::Karafka::Core::Monitoring::Monitor
9
+ attr_reader :notifications_bus
10
+
11
+ # @param notifications_bus [Object] either our internal notifications bus or
12
+ # `ActiveSupport::Notifications`
13
+ # @param namespace [String, nil] namespace for events or nil if no namespace
14
+ def initialize(
15
+ notifications_bus = ::Karafka::Instrumentation::Notifications.new,
16
+ namespace = nil
17
+ )
18
+ super(notifications_bus, namespace)
64
19
  end
65
20
  end
66
21
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ # Namespace for all the things related with Karafka instrumentation process
5
+ module Instrumentation
6
+ # Monitor is used to hookup external monitoring services to monitor how Karafka works
7
+ # It provides a standardized API for checking incoming messages/enqueueing etc
8
+ # Since it is a pub-sub based on dry-monitor, you can use as many subscribers/loggers at the
9
+ # same time, which means that you might have for example file logging and NewRelic at the same
10
+ # time
11
+ # @note This class acts as a singleton because we are only permitted to have single monitor
12
+ # per running process (just as logger)
13
+ class Notifications < Karafka::Core::Monitoring::Notifications
14
+ # List of events that we support in the system and to which a monitor client can hook up
15
+ # @note The non-error once support timestamp benchmarking
16
+ # @note Depending on Karafka extensions and additional engines, this might not be the
17
+ # complete list of all the events. Please use the #available_events on fully loaded
18
+ # Karafka system to determine all of the events you can use.
19
+ EVENTS = %w[
20
+ app.initialized
21
+ app.running
22
+ app.stopping
23
+ app.stopped
24
+
25
+ consumer.consumed
26
+ consumer.revoked
27
+ consumer.shutdown
28
+
29
+ process.notice_signal
30
+
31
+ connection.listener.before_fetch_loop
32
+ connection.listener.fetch_loop
33
+ connection.listener.fetch_loop.received
34
+
35
+ worker.process
36
+ worker.processed
37
+
38
+ statistics.emitted
39
+
40
+ error.occurred
41
+ ].freeze
42
+
43
+ private_constant :EVENTS
44
+
45
+ # @return [Karafka::Instrumentation::Monitor] monitor instance for system instrumentation
46
+ def initialize
47
+ super
48
+ EVENTS.each { |event| register_event(event) }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -11,7 +11,7 @@ module Karafka
11
11
  #
12
12
  # @note You need to setup the `dogstatsd-ruby` client and assign it
13
13
  class Listener
14
- include WaterDrop::Configurable
14
+ include ::Karafka::Core::Configurable
15
15
  extend Forwardable
16
16
 
17
17
  def_delegators :config, :client, :rd_kafka_metrics, :namespace, :default_tags
@@ -12,7 +12,7 @@ module Karafka
12
12
  # enough and will still keep the code simple
13
13
  # @see Karafka::Setup::Configurators::Base for more details about configurators api
14
14
  class Config
15
- extend ::WaterDrop::Configurable
15
+ extend ::Karafka::Core::Configurable
16
16
 
17
17
  # Defaults for kafka settings, that will be overwritten only if not present already
18
18
  KAFKA_DEFAULTS = {
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.0.rc3'
6
+ VERSION = '2.0.0.rc4'
7
7
  end
data/lib/karafka.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  %w[
4
+ karafka-core
4
5
  delegate
5
6
  English
6
7
  rdkafka
@@ -12,8 +13,6 @@
12
13
  openssl
13
14
  base64
14
15
  date
15
- dry/events/publisher
16
- dry/monitor/notifications
17
16
  zeitwerk
18
17
  ].each(&method(:require))
19
18
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc3
4
+ version: 2.0.0.rc4
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-26 00:00:00.000000000 Z
37
+ date: 2022-07-28 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
- name: dry-monitor
40
+ name: karafka-core
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - "~>"
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: '0.5'
45
+ version: 2.0.0
46
+ - - "<"
47
+ - !ruby/object:Gem::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
+ - - ">="
51
54
  - !ruby/object:Gem::Version
52
- version: '0.5'
55
+ version: 2.0.0
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: 3.0.0
53
59
  - !ruby/object:Gem::Dependency
54
60
  name: rdkafka
55
61
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +90,7 @@ dependencies:
84
90
  requirements:
85
91
  - - ">="
86
92
  - !ruby/object:Gem::Version
87
- version: 2.3.3
93
+ version: 2.4.0
88
94
  - - "<"
89
95
  - !ruby/object:Gem::Version
90
96
  version: 3.0.0
@@ -94,7 +100,7 @@ dependencies:
94
100
  requirements:
95
101
  - - ">="
96
102
  - !ruby/object:Gem::Version
97
- version: 2.3.3
103
+ version: 2.4.0
98
104
  - - "<"
99
105
  - !ruby/object:Gem::Version
100
106
  version: 3.0.0
@@ -192,6 +198,7 @@ files:
192
198
  - lib/karafka/instrumentation/logger.rb
193
199
  - lib/karafka/instrumentation/logger_listener.rb
194
200
  - lib/karafka/instrumentation/monitor.rb
201
+ - lib/karafka/instrumentation/notifications.rb
195
202
  - lib/karafka/instrumentation/proctitle_listener.rb
196
203
  - lib/karafka/instrumentation/vendors/datadog/dashboard.json
197
204
  - lib/karafka/instrumentation/vendors/datadog/listener.rb
@@ -277,7 +284,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
284
  requirements:
278
285
  - - ">="
279
286
  - !ruby/object:Gem::Version
280
- version: 2.6.0
287
+ version: 2.7.0
281
288
  required_rubygems_version: !ruby/object:Gem::Requirement
282
289
  requirements:
283
290
  - - ">"
metadata.gz.sig CHANGED
Binary file