exis_ray 0.5.3 → 0.5.4
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 +19 -0
- data/lib/exis_ray/log_subscriber.rb +1 -1
- data/lib/exis_ray/task_monitor.rb +2 -2
- data/lib/exis_ray/tracer.rb +17 -0
- data/lib/exis_ray/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13877001eee2022a6c6de0d2709ef5080b0cc2e43459d5e81ea99d9f28f9b216
|
|
4
|
+
data.tar.gz: c6b551a316813a3671ae980a0fc8061b32fc1b585bc39b49a5c761a73c3af145
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e41a2bc99ab67896aac64e6eb8becca74fd03217807fa16e24ed434477109b053f9d9580b206a2c4f4123fefa6beca5f580b934e22c468175d20fa808179a7eb
|
|
7
|
+
data.tar.gz: 80bc6a49ea2b9ed2e4b45aa3f4e501752edb2d5873a8871cce6ba3b4e1bf4f925fb793a3ba5ab1a0f9c717d4ee63c9411bc1d738ab7d9a742ed48585071664fd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.5.4] - 2026-03-24
|
|
2
|
+
|
|
3
|
+
### Changed
|
|
4
|
+
- **Human-readable durations:** `duration_human` now uses a smarter format: sub-second values show as `"7.2ms"`, values under 60s show as `"1.25s"`, and longer durations use `ActiveSupport::Duration` prose (e.g., `"2 minutes 5 seconds"`).
|
|
5
|
+
- **Shared duration helper:** Extracted `ExisRay::Tracer.format_duration` to consolidate duration formatting used by both `LogSubscriber` and `TaskMonitor`.
|
|
6
|
+
|
|
1
7
|
## [0.5.3] - 2026-03-24
|
|
2
8
|
|
|
3
9
|
### Changed
|
data/README.md
CHANGED
|
@@ -286,6 +286,25 @@ If you don't need extra fields, skip this step — `ExisRay::LogSubscriber` is u
|
|
|
286
286
|
* **`ExisRay::LogSubscriber`**: Replaces Lograge for HTTP request logging. Subscribes to `process_action.action_controller` and suppresses Rails' default multi-line log subscribers. Compatible with Rails 6, 7, and 8. Subclass it and override `self.extra_fields(event)` to inject custom fields.
|
|
287
287
|
* **`ExisRay::TaskMonitor`**: The entry point for non-HTTP processes.
|
|
288
288
|
|
|
289
|
+
## Known Behaviors
|
|
290
|
+
|
|
291
|
+
### Third-party gem warnings in `body`
|
|
292
|
+
|
|
293
|
+
ExisRay captures all log output — including warnings emitted by third-party gems — and routes free-text lines to the `body` field. Some gems may include user-identifying data in their warnings.
|
|
294
|
+
|
|
295
|
+
**Example:** The [Bullet](https://github.com/flyerhzm/bullet) N+1 query detector emits warnings like:
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
user: gabriel
|
|
299
|
+
GET /clients?page=1
|
|
300
|
+
USE eager loading detected
|
|
301
|
+
Client => [:gps_point]
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
This text lands verbatim in `body`. ExisRay does not filter or redact `body` content, as it cannot know what third-party gems will include.
|
|
305
|
+
|
|
306
|
+
**Recommendation:** If you use Bullet or similar gems in production, configure them to use a separate notification channel (e.g., Slack, Honeybadger) instead of `Rails.logger`, to avoid leaking usernames or other PII into your structured logs.
|
|
307
|
+
|
|
289
308
|
## License
|
|
290
309
|
|
|
291
310
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -84,7 +84,7 @@ module ExisRay
|
|
|
84
84
|
action: payload[:action],
|
|
85
85
|
status: status,
|
|
86
86
|
duration_s: duration_s,
|
|
87
|
-
duration_human:
|
|
87
|
+
duration_human: ExisRay::Tracer.format_duration(duration_s),
|
|
88
88
|
view_runtime_s: view_s,
|
|
89
89
|
db_runtime_s: db_s
|
|
90
90
|
}
|
|
@@ -35,12 +35,12 @@ module ExisRay
|
|
|
35
35
|
execute_with_optional_tags { yield }
|
|
36
36
|
|
|
37
37
|
duration_s = ExisRay::Tracer.current_duration_s
|
|
38
|
-
human_time =
|
|
38
|
+
human_time = ExisRay::Tracer.format_duration(duration_s)
|
|
39
39
|
|
|
40
40
|
log_event(:info, "component=exis_ray event=task_finished task=#{task_name} status=success duration_s=#{duration_s} duration_human=\"#{human_time}\"")
|
|
41
41
|
rescue StandardError => e
|
|
42
42
|
duration_s = ExisRay::Tracer.current_duration_s
|
|
43
|
-
human_time =
|
|
43
|
+
human_time = ExisRay::Tracer.format_duration(duration_s)
|
|
44
44
|
|
|
45
45
|
log_event(:error, "component=exis_ray event=task_finished task=#{task_name} status=failed duration_s=#{duration_s} duration_human=\"#{human_time}\" error_class=#{e.class} error_message=#{e.message.inspect}")
|
|
46
46
|
raise e
|
data/lib/exis_ray/tracer.rb
CHANGED
|
@@ -70,6 +70,23 @@ module ExisRay
|
|
|
70
70
|
(Process.clock_gettime(Process::CLOCK_MONOTONIC) - created_at).round(4)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
# Formatea una duración en segundos a un string legible por humanos.
|
|
74
|
+
# - Menos de 1s → "7.2ms"
|
|
75
|
+
# - Entre 1-60s → "1.25s"
|
|
76
|
+
# - 60s o más → "2 minutes 5 seconds" (via ActiveSupport::Duration)
|
|
77
|
+
#
|
|
78
|
+
# @param seconds [Float] Duración en segundos.
|
|
79
|
+
# @return [String]
|
|
80
|
+
def self.format_duration(seconds)
|
|
81
|
+
if seconds < 1.0
|
|
82
|
+
"#{(seconds * 1000).round(1)}ms"
|
|
83
|
+
elsif seconds < 60.0
|
|
84
|
+
"#{seconds.round(3)}s"
|
|
85
|
+
else
|
|
86
|
+
ActiveSupport::Duration.build(seconds.round).inspect
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
73
90
|
# Construye el header de trazabilidad para enviar al siguiente servicio.
|
|
74
91
|
#
|
|
75
92
|
# @return [String] Header formateado: "Root=...;Self=...;CalledFrom=...;TotalTimeSoFar=...ms"
|
data/lib/exis_ray/version.rb
CHANGED