deimos-ruby 2.0.14 → 2.0.15

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: e8597163d34a0b2afd7ef60bbc2eda8f08c4e441292181dc7d15215ad4b2ebd7
4
- data.tar.gz: 364899fa4738dd1df44f98cecc67bdc503f1a679a26274f78b49bd8b29c1ee02
3
+ metadata.gz: d6c9d3bcbf085821dc0be156389bd223dbce36ba8c34ff452612cf82ca3b3be4
4
+ data.tar.gz: fc9bf56f6ad566a9e197e50b5b167af620e9c0d6ec0fd9f50999059b7fded6ee
5
5
  SHA512:
6
- metadata.gz: 54eff5f5b0f375816b3a25516f602985b00440fe522d5495346fcb873d37fb1a822666ad04623c74002a15c15c3a70ba851099096d72eaba8ab9840a460ddbc2
7
- data.tar.gz: 9901785951d244c09fc81ca6601c6700149b2f03f8246f167fe594fce778c035a1f81a1a468045930cf94e5787cecffcefdf069132cfe57686ec0172c8a28f5c
6
+ metadata.gz: 88ac68371a699744e87fcc0c7e8a1294af1b02d4ff6973f95c1667c3754ac8fd0eeda65afddd966a4451058028409e3183e6bca112c553dbf7ac67f72929ffdd
7
+ data.tar.gz: 30f93b2f6aefbdf3b8554bb0a6b5bac53e6638a88adc75bdded31fde88b783ca6311fb50b652f9b8085d32da6175449181dd8229a1544018e0e1c7c51ddc158f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ ## 2.0.15 - 2025-05-29
11
+
12
+ - Fix: Do not force data to JSON when logging payloads. This allows log formatters to handle the payloads on their own (e.g. adding additional fields).
13
+ - Fix: Add topic to "Publishing Messages" log message.
14
+
10
15
  ## 2.0.14 - 2025-05-26
11
16
 
12
17
  - Fix: Log actual payloads by default (was logging "null" for the payload).
@@ -9,9 +9,10 @@ module Deimos
9
9
  # @param messages [Array<Hash>]
10
10
  # @return [void]
11
11
  def publish(producer_class:, messages:)
12
+ topic = producer_class.topic
12
13
  execute(producer_class: producer_class, messages: messages)
13
14
  message = ::Deimos::Logging.messages_log_text(producer_class.karafka_config.payload_log, messages)
14
- Deimos::Logging.log_info({message: 'Publishing Messages:'}.merge(message))
15
+ Deimos::Logging.log_info({message: "Publishing Messages for #{topic}:" }.merge(message))
15
16
  end
16
17
 
17
18
  # @param producer_class [Class<Deimos::Producer>]
@@ -5,10 +5,10 @@ module Deimos
5
5
  def log_add(method, msg)
6
6
  if Karafka.logger.respond_to?(:tagged)
7
7
  Karafka.logger.tagged('Deimos') do |logger|
8
- logger.send(method, msg.to_json)
8
+ logger.send(method, msg)
9
9
  end
10
10
  else
11
- Karafka.logger.send(method, msg.to_json)
11
+ Karafka.logger.send(method, msg)
12
12
  end
13
13
  end
14
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '2.0.14'
4
+ VERSION = '2.0.15'
5
5
  end
@@ -283,15 +283,15 @@ module ProducerTest
283
283
  ]
284
284
  )
285
285
  expect(Karafka.logger).to have_received(:info).with(match_message({
286
- 'message' => 'Publishing Messages:',
287
- 'payloads' => [
286
+ message: 'Publishing Messages for my-topic-with-id:',
287
+ payloads: [
288
288
  {
289
- 'payload' => { 'test_id' => 'foo', 'some_int' => 123 },
290
- 'key' => 'key'
289
+ payload: { 'test_id' => 'foo', 'some_int' => 123 },
290
+ key: 'key'
291
291
  },
292
292
  {
293
- 'payload' => { 'test_id' => 'foo2', 'some_int' => 123 },
294
- 'key' => 'key2'
293
+ payload: { 'test_id' => 'foo2', 'some_int' => 123 },
294
+ key: 'key2'
295
295
  }
296
296
  ]
297
297
  }))
@@ -309,8 +309,8 @@ module ProducerTest
309
309
  ]
310
310
  )
311
311
  expect(Karafka.logger).to have_received(:info).with(match_message({
312
- 'message' => 'Publishing Messages:',
313
- 'payloads_count' => 2
312
+ message: 'Publishing Messages for my-topic-with-id:',
313
+ payloads_count: 2
314
314
  }))
315
315
  end
316
316
  end
data/spec/spec_helper.rb CHANGED
@@ -347,14 +347,13 @@ end
347
347
  RSpec::Matchers.define :match_message do |msg|
348
348
  match do |actual|
349
349
  begin
350
- parsed = JSON.parse(actual)
351
- parsed['payloads']&.each do |p|
352
- p['payload'].delete('timestamp')
353
- p['payload'].delete('message_id')
350
+ return false unless actual.is_a?(Hash)
351
+
352
+ actual[:payloads]&.each do |p|
353
+ p[:payload].delete('timestamp')
354
+ p[:payload].delete('message_id')
354
355
  end
355
- expect(parsed).to match(a_hash_including(msg))
356
- rescue JSON::ParserError
357
- false
356
+ expect(actual).to match(a_hash_including(msg))
358
357
  end
359
358
  end
360
359
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deimos-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-26 00:00:00.000000000 Z
11
+ date: 2025-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf