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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +15 -1
- data/lib/exis_ray/bug_bunny/consumer_tracing.rb +7 -3
- data/lib/exis_ray/bug_bunny/publisher_tracing.rb +2 -4
- data/lib/exis_ray/json_formatter.rb +3 -2
- data/lib/exis_ray/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa3229011d1a59fbd0d65ec137d7a5223f70bd3c3f69add47c27bc965a3e62f1
|
|
4
|
+
data.tar.gz: f08f78169685640fc2c6f1dbfb51c5e64826e4e776c4c1b66ee5d4196592697d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
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
|
-
|
|
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[
|
|
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[
|
|
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
|
-
|
|
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
|
data/lib/exis_ray/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2026-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|