rails_event_viewer 0.4.2 → 0.5.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -1
- data/app/controllers/rails_event_viewer/events_controller.rb +1 -1
- data/app/views/rails_event_viewer/events/show.html.erb +2 -2
- data/lib/rails_event_viewer/adapters/active_record.rb +9 -2
- data/lib/rails_event_viewer/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: 375560c35f98c2ac5f6962d8cfe010a3303a2d6dc1c1be571d2f460d53321aee
|
|
4
|
+
data.tar.gz: 9d7cc22776fd8bcd0b0c7b683f9e67b61e684cb8d5f6977f9443d6f97501f59a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3ff263712f32e6ae3ebe6021048efdf72f2cf008431fc7751c52897e7a8985a35410c26195ae7cd5b4c8cc6c409fd79ce5aee99bff6aa67f5ea1fbbbbdc06e5
|
|
7
|
+
data.tar.gz: '08d8c02f0cd633bcd6bf1e6104cdf7506f342d37611e363eff37377a29e18f5c1bab098e0d5146cc3055926e1dc09d7fbc37d919e8c520349ae0cad8029ac74b'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 (2026-10-05)
|
|
4
|
+
|
|
5
|
+
Breaking:
|
|
6
|
+
|
|
7
|
+
- The ActiveRecord adapter returns events as hashes with symbol keys, like the Memory and Redis adapters. Call `event[:name]`, not `event.name`, and `event[:payload][:order_id]`, not `event.payload["order_id"]`.
|
|
8
|
+
|
|
3
9
|
## 0.4.2 (2026-10-04)
|
|
4
10
|
|
|
5
11
|
Changed:
|
data/README.md
CHANGED
|
@@ -42,9 +42,11 @@ RailsEventViewer.events
|
|
|
42
42
|
.with_tag(:priority, "high")
|
|
43
43
|
.since(1.day.ago)
|
|
44
44
|
.limit(50)
|
|
45
|
-
.
|
|
45
|
+
.map { |event| event[:payload][:order_id] }
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
Each event is a hash with symbol keys, whichever adapter stores it.
|
|
49
|
+
|
|
48
50
|
Other filters: `with_context`, `search`, `until`, `offset`, and `count`.
|
|
49
51
|
Without `limit`, a query returns `config.per_page` events, 25 by default.
|
|
50
52
|
|
|
@@ -42,7 +42,7 @@ module RailsEventViewer
|
|
|
42
42
|
context = event[:context]
|
|
43
43
|
return [] unless context.present?
|
|
44
44
|
|
|
45
|
-
request_id = context[
|
|
45
|
+
request_id = context[:request_id]
|
|
46
46
|
occurred_at = event[:occurred_at]
|
|
47
47
|
return [] unless request_id && occurred_at
|
|
48
48
|
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
<%= format_event_time(@event) %>
|
|
85
85
|
</dd>
|
|
86
86
|
</div>
|
|
87
|
-
<% if @event
|
|
87
|
+
<% if @event[:created_at] %>
|
|
88
88
|
<div class="px-6 py-4">
|
|
89
89
|
<dt class="text-sm font-medium text-gray-500">Created At</dt>
|
|
90
90
|
<dd class="mt-1 text-sm text-gray-900">
|
|
91
|
-
<%= @event
|
|
91
|
+
<%= @event[:created_at].strftime("%Y-%m-%d %H:%M:%S %Z") %>
|
|
92
92
|
</dd>
|
|
93
93
|
</div>
|
|
94
94
|
<% end %>
|
|
@@ -36,6 +36,7 @@ module RailsEventViewer
|
|
|
36
36
|
build_scope(relation)
|
|
37
37
|
.offset(relation.offset_value)
|
|
38
38
|
.limit(relation.limit_value)
|
|
39
|
+
.map { |entry| to_event(entry) }
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def count_events(relation)
|
|
@@ -47,7 +48,8 @@ module RailsEventViewer
|
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def find_event(id)
|
|
50
|
-
Entry.find_by(id: id)
|
|
51
|
+
entry = Entry.find_by(id: id)
|
|
52
|
+
to_event(entry) if entry
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
def delete_before(timestamp)
|
|
@@ -111,7 +113,8 @@ module RailsEventViewer
|
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
def fetch_last(relation)
|
|
114
|
-
build_scope(relation).reorder(occurred_at: :asc, id: :asc).first
|
|
116
|
+
entry = build_scope(relation).reorder(occurred_at: :asc, id: :asc).first
|
|
117
|
+
to_event(entry) if entry
|
|
115
118
|
end
|
|
116
119
|
|
|
117
120
|
def event_time_span(relation)
|
|
@@ -125,6 +128,10 @@ module RailsEventViewer
|
|
|
125
128
|
|
|
126
129
|
private
|
|
127
130
|
|
|
131
|
+
def to_event(entry)
|
|
132
|
+
entry.attributes.deep_symbolize_keys
|
|
133
|
+
end
|
|
134
|
+
|
|
128
135
|
def parse_timestamp(value)
|
|
129
136
|
return nil if value.nil?
|
|
130
137
|
return value if value.is_a?(Time)
|