karafka-core 2.0.10 → 2.0.12

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: fe29c2f11c04331a98b17f3828b1c3f06b98a262f52acccbdc16d7425db75c8a
4
- data.tar.gz: c82f5aa772769ac4fb36729f17739d6ddc1adb01c2985739e91ebdc6590bbaa0
3
+ metadata.gz: 1896383dc8b2e0c161c30a66e3f95b91a83bd14b23f71f219a7aa58d3935410d
4
+ data.tar.gz: 7aff174b4151e3553767e39c2bcaa8227319e663c3d30ddcae0b3e3c8bca387c
5
5
  SHA512:
6
- metadata.gz: 19b4410f4e65330729f8a11bf1af00b9820519f302eb93371ad48d9fe89a8b4e157f310e94d8cfa88fc0891902c52109e8bfd04200d6240e98246e925f1ad199
7
- data.tar.gz: 8b0a2c93a04982e1fc593c793937af46812a3fb1e56dbda5ebb27b8c412685e73dbf03d55993ab68b6546002894281a40cff0830800e76f240c256dee982424b
6
+ metadata.gz: 64dd16a56f9ddc8e56e0c7fb7451df7b4e3d7b5d03c89d6a6c9f748d820b1203dfd436e1246fb596988d2a4757fc2bbca60252a37760bf04cbde72c63f5d0e62
7
+ data.tar.gz: ce8eb5da3c9ba4c765aa38ef3e91dd0b21809ca7f7e5833a7015ad434d5dd264af340fa7af509b0b7a1e3091e35d773e33ea620c7f79cb6acca403ed4622d733
checksums.yaml.gz.sig CHANGED
Binary file
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Karafka core changelog
2
2
 
3
+ ## 2.0.12 (2023-02-23)
4
+ - Introduce ability to tag certain objects by including the `Karafka::Core::Taggable` module.
5
+
6
+ ## 2.0.11 (2023-02-12)
7
+ - Set minimum `karafka-rdkafka` on `0.12.1`.
8
+
3
9
  ## 2.0.10 (2023-02-01)
4
10
  - Move `RspecLocator` to core.
5
11
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.0.10)
4
+ karafka-core (2.0.12)
5
5
  concurrent-ruby (>= 1.1)
6
- karafka-rdkafka (>= 0.12)
6
+ karafka-rdkafka (>= 0.12.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -22,7 +22,7 @@ GEM
22
22
  ffi (1.15.5)
23
23
  i18n (1.12.0)
24
24
  concurrent-ruby (~> 1.0)
25
- karafka-rdkafka (0.12.0)
25
+ karafka-rdkafka (0.12.1)
26
26
  ffi (~> 1.15)
27
27
  mini_portile2 (~> 2.6)
28
28
  rake (> 12)
@@ -33,7 +33,7 @@ GEM
33
33
  rspec-core (~> 3.12.0)
34
34
  rspec-expectations (~> 3.12.0)
35
35
  rspec-mocks (~> 3.12.0)
36
- rspec-core (3.12.0)
36
+ rspec-core (3.12.1)
37
37
  rspec-support (~> 3.12.0)
38
38
  rspec-expectations (3.12.2)
39
39
  diff-lcs (>= 1.2.0, < 2.0)
@@ -52,7 +52,6 @@ GEM
52
52
  concurrent-ruby (~> 1.0)
53
53
 
54
54
  PLATFORMS
55
- arm64-darwin-21
56
55
  x86_64-linux
57
56
 
58
57
  DEPENDENCIES
@@ -63,4 +62,4 @@ DEPENDENCIES
63
62
  simplecov
64
63
 
65
64
  BUNDLED WITH
66
- 2.4.5
65
+ 2.4.6
data/README.md CHANGED
@@ -6,11 +6,12 @@
6
6
 
7
7
  Karafka-Core contains toolset of small support modules used throughout the [Karafka](https://github.com/karafka/karafka/) ecosystem.
8
8
 
9
- It includes
9
+ It includes:
10
10
 
11
11
  - `Karafka::Core::Monitoring` - default instrumentation and abstraction that allows to use either itself, `dry-monitor` or `ActiveSupport::Notifications`.
12
12
  - `Karafka::Core::Configurable` - configuration engine inspired by `dry-config` with similar but simplified API.
13
13
  - `Karafka::Core::Contractable` - contracts inspired by `dry-validation` but with simplified API.
14
+ - `Karafka::Core::Taggable` - adds ability to attach `#tags` to objects for extra labeling.
14
15
 
15
16
  ## Note on contributions
16
17
 
data/karafka-core.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.licenses = %w[MIT]
18
18
 
19
19
  spec.add_dependency 'concurrent-ruby', '>= 1.1'
20
- spec.add_dependency 'karafka-rdkafka', '>= 0.12'
20
+ spec.add_dependency 'karafka-rdkafka', '>= 0.12.1'
21
21
 
22
22
  spec.required_ruby_version = '>= 2.6.0'
23
23
 
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Core
5
+ module Taggable
6
+ # This allows us to collect tags about given object. We attach name to each tag, because we
7
+ # may want to replace given tag with a different one and we need to have a reference of
8
+ # what we want to replace
9
+ class Tags
10
+ # Creates new tags accumulator
11
+ def initialize
12
+ @accu = {}
13
+ end
14
+
15
+ # Adds a tag with a given name to tags
16
+ # @param name [Symbol] name we want to use for a given tag
17
+ # @param tag [#to_s] any object that can be converted into a string via `#to_s`
18
+ def add(name, tag)
19
+ @accu[name] = tag.to_s
20
+ end
21
+
22
+ # Removes all the tags
23
+ def clear
24
+ @accu.clear
25
+ end
26
+
27
+ # Removes a tag with a given name
28
+ # @param name [Symbol] name of the tag
29
+ def delete(name)
30
+ @accu.delete(name)
31
+ end
32
+
33
+ # @return [Array<String>] all unique tags registered
34
+ def to_a
35
+ @accu.values.tap(&:uniq!)
36
+ end
37
+
38
+ # @param _args [Object] anything that the standard `to_json` accepts
39
+ # @return [String] json representation of tags
40
+ def to_json(*_args)
41
+ to_a.to_json
42
+ end
43
+
44
+ # @param _args [Object] anything that the standard `as_json` accepts
45
+ # @return [Array<String>] array that can be converted to json
46
+ def as_json(*_args)
47
+ to_a
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Core
5
+ # Namespace related to extension allowing to attach tags to any object.
6
+ # It can be used to assign tags in runtime to objects and use those tags in metrics, reporting
7
+ # and other places.
8
+ #
9
+ # Tags will be converted to strings when they are added
10
+ module Taggable
11
+ # @return [::Karafka::Core::Taggable::Tags] tags object
12
+ def tags
13
+ @tags ||= Taggable::Tags.new
14
+ end
15
+ end
16
+ end
17
+ end
@@ -4,6 +4,6 @@ module Karafka
4
4
  module Core
5
5
  # Current Karafka::Core version
6
6
  # We follow the versioning schema of given Karafka version
7
- VERSION = '2.0.10'
7
+ VERSION = '2.0.12'
8
8
  end
9
9
  end
data/lib/karafka-core.rb CHANGED
@@ -30,6 +30,9 @@
30
30
  karafka/core/instrumentation
31
31
  karafka/core/instrumentation/callbacks_manager
32
32
 
33
+ karafka/core/taggable
34
+ karafka/core/taggable/tags
35
+
33
36
  karafka/core/patches/rdkafka/bindings
34
37
  ].each { |dependency| require dependency }
35
38
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-02-01 00:00:00.000000000 Z
38
+ date: 2023-02-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: concurrent-ruby
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '0.12'
60
+ version: 0.12.1
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '0.12'
67
+ version: 0.12.1
68
68
  description: A toolset of small support modules used throughout the Karafka ecosystem
69
69
  email:
70
70
  - contact@karafka.io
@@ -111,6 +111,8 @@ files:
111
111
  - lib/karafka/core/monitoring/notifications.rb
112
112
  - lib/karafka/core/monitoring/statistics_decorator.rb
113
113
  - lib/karafka/core/patches/rdkafka/bindings.rb
114
+ - lib/karafka/core/taggable.rb
115
+ - lib/karafka/core/taggable/tags.rb
114
116
  - lib/karafka/core/version.rb
115
117
  - log/.gitkeep
116
118
  homepage: https://karafka.io
@@ -139,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
141
  - !ruby/object:Gem::Version
140
142
  version: '0'
141
143
  requirements: []
142
- rubygems_version: 3.4.1
144
+ rubygems_version: 3.4.6
143
145
  signing_key:
144
146
  specification_version: 4
145
147
  summary: Karafka ecosystem core modules
metadata.gz.sig CHANGED
Binary file