sbmt-kafka_consumer 3.1.0 → 3.2.1

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: f56ef789be2f19f5e5890292e8163f29d65ced1de23358b3a0bcf4163b77587d
4
- data.tar.gz: 6f7450a9ecf65d6d32294f26142706a7c523af2073be90e9cb9bc6a630ae73f9
3
+ metadata.gz: 4d68fc606cb503382ebd9ff90d5e9a9c191c6905e0d76aeccfdef8d2fd98f2f4
4
+ data.tar.gz: 847b1844371d842ed88cbfcfbff48f95d74de91a5b108869cdbba3238494a821
5
5
  SHA512:
6
- metadata.gz: 0bab92c52ee0dd45b2893f1e592a480b53c055d2addd522d8ab22bdc8b83068983734974ba56aaf47d370dd6f42b342ec5e1cc8623f8e8a4833ccf112e23bdf2
7
- data.tar.gz: f159851f5089686e1b767f53852257d10575bb4c532e603f8d3a9169f7500556a802bf0e79e60de19c6056d213347782a7334f6a67c5f9ec5f3bc9a2085c472f
6
+ metadata.gz: 4f3e97d8a636a24a7b81304be3410ee5e9960017369a1a7fcee8a166166cf8b5503ab9641cdf455d84cefaab69469ae1530c40e69aa1bc97eb3b4fa1cae1f501
7
+ data.tar.gz: 5f8177ca6245d822974dc32a763628e7720ec89921fd45dc9ddeecf61dc9360b0690f9280fed400048afc2b02ac72b7c5c46a61e1068c92dd9d567b0e33db735
data/CHANGELOG.md CHANGED
@@ -13,6 +13,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ### Fixed
15
15
 
16
+ ## [3.2.1] - 2024-09-20
17
+
18
+ ### Fixed
19
+
20
+ - Limit Karafka version to less than 2.4.12 since `bootstrap.servers` has been made required
21
+
22
+ ## [3.2.0] - 2024-09-17
23
+
24
+ ### Added
25
+
26
+ - For synchronous messages and errors, we place logs in tags
27
+
16
28
  ## [3.1.0] - 2024-09-09
17
29
 
18
30
  ### Fixed
@@ -45,9 +45,7 @@ module Sbmt
45
45
 
46
46
  def with_instrumentation(message)
47
47
  logger.tagged(
48
- trace_id: trace_id,
49
- topic: message.metadata.topic, partition: message.metadata.partition,
50
- key: message.metadata.key, offset: message.metadata.offset
48
+ trace_id: trace_id
51
49
  ) do
52
50
  ::Sbmt::KafkaConsumer.monitor.instrument(
53
51
  "consumer.consumed_one",
@@ -20,30 +20,56 @@ module Sbmt
20
20
 
21
21
  logger.tagged(
22
22
  type: type,
23
+ stacktrace: log_backtrace(error),
23
24
  **tags
24
25
  ) do
25
26
  logger.error(error_message(error))
26
- log_backtrace(error)
27
27
  end
28
28
  end
29
29
 
30
30
  # BaseConsumer events
31
31
  def on_consumer_consumed_one(event)
32
- logger.info("Successfully consumed message in #{event.payload[:time]} ms")
32
+ log_with_tags(log_tags(event), "Successfully consumed message")
33
33
  end
34
34
 
35
35
  def on_consumer_mark_as_consumed(event)
36
- logger.info("Processing message in #{event.payload[:time]} ms")
36
+ log_with_tags(log_tags(event), "Processing message")
37
37
  end
38
38
 
39
39
  def on_consumer_process_message(event)
40
- logger.info("Commit offset in #{event.payload[:time]} ms")
40
+ log_with_tags(log_tags(event), "Commit offset")
41
41
  end
42
42
 
43
43
  # InboxConsumer events
44
44
  def on_consumer_inbox_consumed_one(event)
45
- logger.tagged(status: event[:status]) do
46
- logger.info("Successfully consumed message with uuid: #{event[:message_uuid]} in #{event.payload[:time]} ms")
45
+ log_tags = log_tags(event).merge!(status: event[:status])
46
+ msg = "Successfully consumed message with uuid: #{event[:message_uuid]}"
47
+
48
+ log_with_tags(log_tags, msg)
49
+ end
50
+
51
+ private
52
+
53
+ def log_tags(event)
54
+ metadata = event.payload[:message].metadata
55
+
56
+ {
57
+ kafka: {
58
+ topic: metadata.topic,
59
+ partition: metadata.partition,
60
+ key: metadata.key,
61
+ offset: metadata.offset,
62
+ consumer_group: event.payload[:caller].topic.consumer_group.id,
63
+ consume_duration_ms: event.payload[:time]
64
+ }
65
+ }
66
+ end
67
+
68
+ def log_with_tags(log_tags, msg)
69
+ return unless logger.respond_to?(:tagged)
70
+
71
+ logger.tagged(log_tags) do
72
+ logger.send(:info, msg)
47
73
  end
48
74
  end
49
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sbmt
4
4
  module KafkaConsumer
5
- VERSION = "3.1.0"
5
+ VERSION = "3.2.1"
6
6
  end
7
7
  end
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency "rails", ">= 6.1"
35
35
  spec.add_dependency "zeitwerk", "~> 2.3"
36
- spec.add_dependency "karafka", "~> 2.4"
36
+ spec.add_dependency "karafka", "~> 2.4", "< 2.4.12"
37
37
  spec.add_dependency "yabeda", ">= 0.11"
38
38
  spec.add_dependency "anyway_config", ">= 2.4.0"
39
39
  spec.add_dependency "thor"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbmt-kafka_consumer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuper Ruby-Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2024-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.4'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 2.4.12
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '2.4'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 2.4.12
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: yabeda
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -565,7 +571,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
565
571
  - !ruby/object:Gem::Version
566
572
  version: '0'
567
573
  requirements: []
568
- rubygems_version: 3.3.7
574
+ rubygems_version: 3.1.6
569
575
  signing_key:
570
576
  specification_version: 4
571
577
  summary: Ruby gem for consuming Kafka messages