bug_bunny 4.2.0 → 4.3.0

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: 26437c12bdcd679124739cffc4d1c9769587bc6ffd241d6a03a75880c3bd910d
4
- data.tar.gz: cc185721833cbf505d1fe44ac1dac7ac496fda1677b54898ce950a1d1badff68
3
+ metadata.gz: 67cd206fe5bbd998fd71e143d5b22972d841439115209a007223b776630ebf46
4
+ data.tar.gz: 6647fc999934cc49b636f32e50f8cdad8c21effd4005a8ff403b233498ee75af
5
5
  SHA512:
6
- metadata.gz: 71da0a97f33b38263957a878350e8a2daa935a0f211e0fa59af589b507a7d11635e84ac6170ee2a4fafb16b0c4f8ddeec61b388f38d7f9856d171e3059b004f3
7
- data.tar.gz: 962de8a788d263c04cf0d9fa5da2e6c3a5ec3a2d6156b80ff542b8d2fd333c4d9d0915f94775f8fb9c8101d507691cf757701904fe1d0477d5dabfcd006efa7e
6
+ metadata.gz: 1cc705a67bef35d982a2c2ed1117c70fc7dc14f79a6a4b9b70e8e7549f0d6db860070e0c6b85e859ef7239f7a322988d8d5054a0ef88e6a363faf911a87dd9d7
7
+ data.tar.gz: 7ba4187d186d391fb9e8b42da9d1e7c0a1656f059421a6249c8c3c2c45f1fcdeddf5070a0845245d0371e17250df0a83f674cf77eb188794e95d95e79103a9e3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.3.0] - 2026-03-24
4
+
5
+ ### 📈 Observability Alignment (ExisRay Standards)
6
+ * **Monotonic Clock Durations:** Implementación de `Process.clock_gettime(Process::CLOCK_MONOTONIC)` para calcular todas las duraciones técnicas y de negocio (`duration_s`), garantizando precisión en entornos Cloud.
7
+ * **Unit-Suffix Keys (Data First):** Se renombraron las llaves de logs para incluir explícitamente su unidad:
8
+ * `timeout` -> `timeout_s`
9
+ * `retry_in` -> `retry_in_s`
10
+ * `attempt` -> `attempt_count`
11
+ * `max_attempts` -> `max_attempts_count`
12
+ * **Error Field Standardization:** Se renombraron todos los campos `error` a `error_message` para ser consistentes con los eventos de falla de `exis_ray`.
13
+ * **Automatic Field Removal:** Se eliminó la inyección manual de `source` delegando la responsabilidad a la gema `exis_ray`.
14
+
3
15
  ## [4.2.0] - 2026-03-22
4
16
 
5
17
  ### 🔠Observability & Structured Logging
@@ -100,7 +100,7 @@ module BugBunny
100
100
  max_attempts = BugBunny.configuration.max_reconnect_attempts
101
101
 
102
102
  if max_attempts && attempt >= max_attempts
103
- BugBunny.configuration.logger.error { "component=bug_bunny event=reconnect_exhausted attempts=#{max_attempts} error=#{e.message.inspect}" }
103
+ BugBunny.configuration.logger.error { "component=bug_bunny event=reconnect_exhausted max_attempts_count=#{max_attempts} error_message=#{e.message.inspect}" }
104
104
  raise
105
105
  end
106
106
 
@@ -109,7 +109,7 @@ module BugBunny
109
109
  BugBunny.configuration.max_reconnect_interval
110
110
  ].min
111
111
 
112
- BugBunny.configuration.logger.error { "component=bug_bunny event=connection_error error=#{e.message.inspect} attempt=#{attempt} max_attempts=#{max_attempts || 'infinity'} retry_in=#{wait}" }
112
+ BugBunny.configuration.logger.error { "component=bug_bunny event=connection_error error_message=#{e.message.inspect} attempt_count=#{attempt} max_attempts_count=#{max_attempts || 'infinity'} retry_in_s=#{wait}" }
113
113
  sleep wait
114
114
  retry
115
115
  end
@@ -126,6 +126,8 @@ module BugBunny
126
126
  # @param body [String] El payload crudo del mensaje.
127
127
  # @return [void]
128
128
  def process_message(delivery_info, properties, body)
129
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
130
+
129
131
  # 1. Validación de Headers (URL path)
130
132
  path = properties.type || (properties.headers && properties.headers['path'])
131
133
 
@@ -215,8 +217,12 @@ module BugBunny
215
217
 
216
218
  session.channel.ack(delivery_info.delivery_tag)
217
219
 
220
+ duration_s = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time).round(6)
221
+ BugBunny.configuration.logger.info("component=bug_bunny event=message_processed status=#{response_payload[:status]} duration_s=#{duration_s} controller=#{controller_class_name} action=#{route_info[:action]}")
222
+
218
223
  rescue StandardError => e
219
- BugBunny.configuration.logger.error { "component=bug_bunny event=execution_error error_class=#{e.class} error=#{e.message.inspect}" }
224
+ duration_s = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time).round(6)
225
+ BugBunny.configuration.logger.error { "component=bug_bunny event=execution_error error_class=#{e.class} error_message=#{e.message.inspect} duration_s=#{duration_s}" }
220
226
  BugBunny.configuration.logger.debug { "component=bug_bunny event=execution_error backtrace=#{e.backtrace.first(5).join(' | ').inspect}" }
221
227
  handle_fatal_error(properties, 500, "Internal Server Error", e.message)
222
228
  session.channel.reject(delivery_info.delivery_tag, false)
@@ -278,7 +284,7 @@ module BugBunny
278
284
  # 2. Si llegamos aquí, RabbitMQ y la cola están vivos. Avisamos al orquestador actualizando el archivo.
279
285
  touch_health_file(file_path) if file_path
280
286
  rescue StandardError => e
281
- BugBunny.configuration.logger.warn("component=bug_bunny event=health_check_failed queue=#{q_name} error=#{e.message.inspect}")
287
+ BugBunny.configuration.logger.warn("component=bug_bunny event=health_check_failed queue=#{q_name} error_message=#{e.message.inspect}")
282
288
  session.close
283
289
  end
284
290
  @health_timer.execute
@@ -293,7 +299,7 @@ module BugBunny
293
299
  def touch_health_file(file_path)
294
300
  FileUtils.touch(file_path)
295
301
  rescue StandardError => e
296
- BugBunny.configuration.logger.error("component=bug_bunny event=health_check_file_error path=#{file_path} error=#{e.message.inspect}")
302
+ BugBunny.configuration.logger.error("component=bug_bunny event=health_check_file_error path=#{file_path} error_message=#{e.message.inspect}")
297
303
  end
298
304
  end
299
305
  end
@@ -204,7 +204,7 @@ module BugBunny
204
204
  end
205
205
 
206
206
  # Fallback genérico si la excepción no fue mapeada
207
- BugBunny.configuration.logger.error { "component=bug_bunny event=unhandled_exception error_class=#{exception.class} error=#{exception.message.inspect}" }
207
+ BugBunny.configuration.logger.error { "component=bug_bunny event=unhandled_exception error_class=#{exception.class} error_message=#{exception.message.inspect}" }
208
208
  BugBunny.configuration.logger.error { "component=bug_bunny event=unhandled_exception backtrace=#{exception.backtrace.first(5).join(' | ').inspect}" }
209
209
 
210
210
  {
@@ -73,7 +73,7 @@ module BugBunny
73
73
  begin
74
74
  fire(request)
75
75
 
76
- BugBunny.configuration.logger.debug { "component=bug_bunny event=rpc_waiting correlation_id=#{cid} timeout=#{wait_timeout}" }
76
+ BugBunny.configuration.logger.debug { "component=bug_bunny event=rpc_waiting correlation_id=#{cid} timeout_s=#{wait_timeout}" }
77
77
 
78
78
  # Bloqueamos el hilo aquí hasta que llegue la respuesta o expire el timeout
79
79
  response_payload = future.value(wait_timeout)
@@ -128,7 +128,7 @@ module BugBunny
128
128
  BugBunny.configuration.logger.warn('component=bug_bunny event=reconnect_attempt')
129
129
  @connection.start
130
130
  rescue StandardError => e
131
- BugBunny.configuration.logger.error { "component=bug_bunny event=reconnect_failed error=#{e.message.inspect}" }
131
+ BugBunny.configuration.logger.error { "component=bug_bunny event=reconnect_failed error_message=#{e.message.inspect}" }
132
132
  raise BugBunny::CommunicationError, "Could not reconnect to RabbitMQ: #{e.message}"
133
133
  end
134
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BugBunny
4
- VERSION = "4.2.0"
4
+ VERSION = "4.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bug_bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gabix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-22 00:00:00.000000000 Z
11
+ date: 2026-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny