karafka-core 2.0.11 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/karafka/core/taggable/tags.rb +52 -0
- data/lib/karafka/core/taggable.rb +17 -0
- data/lib/karafka/core/version.rb +1 -1
- data/lib/karafka-core.rb +3 -0
- data.tar.gz.sig +1 -2
- metadata +4 -2
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1896383dc8b2e0c161c30a66e3f95b91a83bd14b23f71f219a7aa58d3935410d
|
4
|
+
data.tar.gz: 7aff174b4151e3553767e39c2bcaa8227319e663c3d30ddcae0b3e3c8bca387c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64dd16a56f9ddc8e56e0c7fb7451df7b4e3d7b5d03c89d6a6c9f748d820b1203dfd436e1246fb596988d2a4757fc2bbca60252a37760bf04cbde72c63f5d0e62
|
7
|
+
data.tar.gz: ce8eb5da3c9ba4c765aa38ef3e91dd0b21809ca7f7e5833a7015ad434d5dd264af340fa7af509b0b7a1e3091e35d773e33ea620c7f79cb6acca403ed4622d733
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
@@ -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
|
data/lib/karafka/core/version.rb
CHANGED
data/lib/karafka-core.rb
CHANGED
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��q�^���X痹F 5���Q֘V�hCތ���Lw��o�~
|
1
|
+
�v���]z��,��"a����ٙӬj�������O���!���̀��ͽ~%��J*d��#�Zq��{ 0lm�=��G-~־��[38��H�%t�������;�2���%il�K������J�\�ac�R2E+,��얠t�{Y�"h�YꩯPL}tQ��ܵ����$�e�?<蹫m|�,��);�s� �B��3��jq��z��7JeXͣ�wo��p������@�D]۫���כj*�+jj�:�Q$�����v�yh��_9N��np ��д�����*�Y���=��\��l<*�?�Q�x�1A)�0���A��Q�q&�_�E�Ej6�y$��p�ט.̔��}]26E���l��sVk,�WR
|
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.
|
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-
|
38
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: concurrent-ruby
|
@@ -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
|
metadata.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
G��Cġv�B)�c�}��b�M�TA�:��~�����g�'�!
|
3
|
-
��9�B�"�P�1l�K,~����:l�53��fxx-M��9���+s�JOu@T�3't�pC�ΣSl&��i�}>{��R�)��]����St�4��!t��`As�i�?�|4�M{�<}}*?9^�f�Bm�ڶ�n�+�,1˃;�(h��~�3���<��f����c��t�v�C�i3�"�2�e�O�����4�H+���\��ъxWC�G��F���E?��u թ�
|
1
|
+
_�r`���:jf�Ϋ͂���Q�����*�������>���S���K�H>�PU�75���`t��T�}����pHaK.>�2���n�6H��E�AJ�1�(t�Z�Xv?8�?id���;��C�v[M+�-dD����E�ۜ[id���G��g7\ y�s��p�7֧=�Oq,�l�l|Y��??Q``�Z����CR�vU8ȃc2����V^Z�kͥn.��b��g�\��b��%j�R�`�2O�x!
|