exis_ray 0.5.6 → 0.5.7

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: d66d71924fff9cf19c12e42d411963948739da61e6b223db1444c16633a3158e
4
- data.tar.gz: 26c599899ecf1f87388c73e1b4a183370e0902893c09e40c24c7796c973c0d96
3
+ metadata.gz: fa3229011d1a59fbd0d65ec137d7a5223f70bd3c3f69add47c27bc965a3e62f1
4
+ data.tar.gz: f08f78169685640fc2c6f1dbfb51c5e64826e4e776c4c1b66ee5d4196592697d
5
5
  SHA512:
6
- metadata.gz: 60c34361234b638c3758b3b51d38933efcbf5db19fb8e1a9365f53f1e21bcfc42e680ceb37755c792663e7146826af2453d862b7ae526481870f65518a84b311
7
- data.tar.gz: e3cb2ffc12e45d5bdd6f3c1d1a864bc9884b7709c531fa2780923834f0ca4d4766c75148c6afd15aac4d6a6dbf716a151042620474127b544b779fa86ec9c62b
6
+ metadata.gz: cc5941334d4f7a7241ba6629d5e27f08ac93ce6e704aaa31b90868a5353ff92143795b3b21cb6426d6b47172fa457de3e834899212b9b8ef1a8b28c4a1d81895
7
+ data.tar.gz: 3d9113cc7e2ed5790723290ff9c635b15bb8d4ec6b649c55cf3aab406a8e12d3598dff59d2f2c12d310d256a3f535fda4f816ee66d196e752c5ffb9e8d9d33e3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.5.7] - 2026-03-27
2
+
3
+ ### Fixed
4
+ - **JSON HTML Escaping:** `JsonFormatter` now uses `JSON.generate` with `ascii_only: false` instead of `.to_json`, preventing `>` from being escaped as `\u003e` in log output.
5
+ - **BugBunny Header Standardization:** `PublisherTracing` and `ConsumerTracing` now use `ExisRay.configuration.propagation_trace_header` instead of the hardcoded `'x-trace-id'` constant, aligning with the same pattern used by `FaradayMiddleware` and `ActiveResourceInstrumentation`. The header is now fully configurable and consistent across all outgoing transports.
6
+
1
7
  ## [0.5.6] - 2026-03-26
2
8
 
3
9
  ### Added
data/README.md CHANGED
@@ -207,7 +207,9 @@ If your app publishes messages via [BugBunny](https://github.com/gedera/bug_bunn
207
207
 
208
208
  #### Publisher — inject the trace header
209
209
 
210
- Add `ExisRay::BugBunny::PublisherTracing` to your client middleware stack. Works with both `BugBunny::Client` and `BugBunny::Resource`.
210
+ Add `ExisRay::BugBunny::PublisherTracing` to your publisher middleware stack.
211
+
212
+ **Using `BugBunny::Client` directly:**
211
213
 
212
214
  ```ruby
213
215
  client = BugBunny::Client.new(pool: connection_pool) do |stack|
@@ -216,6 +218,18 @@ client = BugBunny::Client.new(pool: connection_pool) do |stack|
216
218
  end
217
219
  ```
218
220
 
221
+ **Using `BugBunny::Resource`** (via `client_middleware`):
222
+
223
+ ```ruby
224
+ class ApplicationResource < BugBunny::Resource
225
+ client_middleware do |stack|
226
+ stack.use ExisRay::BugBunny::PublisherTracing
227
+ end
228
+ end
229
+ ```
230
+
231
+ Defining it once in a base `ApplicationResource` is enough — all subclasses inherit the middleware stack automatically.
232
+
219
233
  If no trace context is active (e.g. a standalone script), the middleware does nothing.
220
234
 
221
235
  #### Consumer — restore the trace context
@@ -5,7 +5,8 @@ require 'active_support/concern'
5
5
  module ExisRay
6
6
  module BugBunny
7
7
  # Concern para BugBunny::Controller que restaura el trace context de ExisRay
8
- # a partir del header 'x-trace-id' inyectado por el publicador.
8
+ # a partir del header configurado en `ExisRay.configuration.propagation_trace_header`
9
+ # (por defecto `'X-Amzn-Trace-Id'`) inyectado por el publicador.
9
10
  #
10
11
  # Permite que todos los logs emitidos durante el procesamiento de un mensaje
11
12
  # incluyan el mismo root_id y correlation_id que el request HTTP original,
@@ -22,7 +23,10 @@ module ExisRay
22
23
  extend ActiveSupport::Concern
23
24
 
24
25
  # Header AMQP desde el cual se lee el trace context propagado.
25
- TRACE_HEADER = 'x-trace-id'
26
+ # Debe coincidir con `propagation_trace_header` usado por el publisher.
27
+ def self.trace_header
28
+ ExisRay.configuration.propagation_trace_header
29
+ end
26
30
 
27
31
  included do
28
32
  around_action :exis_ray_trace_context
@@ -46,7 +50,7 @@ module ExisRay
46
50
  #
47
51
  # @return [void]
48
52
  def setup_exis_ray_context
49
- trace_header = headers[TRACE_HEADER]
53
+ trace_header = headers[self.class.trace_header]
50
54
  return unless trace_header.present?
51
55
 
52
56
  ExisRay::Tracer.hydrate(trace_id: trace_header, source: 'system')
@@ -21,18 +21,16 @@ module ExisRay
21
21
  # end
22
22
  # end
23
23
  class PublisherTracing < ::BugBunny::Middleware::Base
24
- # Header AMQP personalizado para propagar el trace context entre servicios.
25
- TRACE_HEADER = 'x-trace-id'
26
-
27
24
  # Inyecta el header de traza antes de publicar el mensaje.
28
25
  # Solo actúa si hay un trace context activo (root_id presente).
26
+ # Usa `propagation_trace_header` de la configuración, igual que FaradayMiddleware.
29
27
  #
30
28
  # @param env [BugBunny::Request] El objeto request del mensaje saliente.
31
29
  # @return [void]
32
30
  def on_request(env)
33
31
  return unless ExisRay::Tracer.root_id.present?
34
32
 
35
- env.headers[TRACE_HEADER] = ExisRay::Tracer.generate_trace_header
33
+ env.headers[ExisRay.configuration.propagation_trace_header] = ExisRay::Tracer.generate_trace_header
36
34
  rescue StandardError
37
35
  # La propagación de tracing nunca debe interrumpir la publicación de mensajes.
38
36
  end
@@ -47,8 +47,9 @@ module ExisRay
47
47
  inject_current_tags(payload)
48
48
  process_message(payload, msg)
49
49
 
50
- # Compactamos para eliminar claves con valores nulos (nil) y generamos el JSON
51
- "#{payload.compact.to_json}\n"
50
+ # Compactamos para eliminar claves con valores nulos (nil) y generamos el JSON.
51
+ # Usamos JSON.generate con unsafe_chars para evitar el escape HTML de > como \u003e.
52
+ "#{JSON.generate(payload.compact, { ascii_only: false })}\n"
52
53
  end
53
54
 
54
55
  private
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ExisRay
4
4
  # Versión actual de la gema.
5
- VERSION = "0.5.6"
5
+ VERSION = "0.5.7"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exis_ray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Edera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-26 00:00:00.000000000 Z
11
+ date: 2026-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport