rails_event_viewer 0.4.1 → 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 +17 -0
- data/README.md +3 -1
- data/app/controllers/rails_event_viewer/dashboard_controller.rb +1 -1
- data/app/controllers/rails_event_viewer/events_controller.rb +1 -1
- data/app/helpers/rails_event_viewer/application_helper.rb +2 -2
- data/app/views/rails_event_viewer/dashboard/index.html.erb +1 -1
- data/app/views/rails_event_viewer/events/index.html.erb +1 -1
- data/app/views/rails_event_viewer/events/show.html.erb +4 -4
- data/app/views/rails_event_viewer/groups/show.html.erb +5 -1
- 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,22 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.4.2 (2026-10-04)
|
|
10
|
+
|
|
11
|
+
Changed:
|
|
12
|
+
|
|
13
|
+
- Group durations are rounded and show only the two largest units.
|
|
14
|
+
- Source paths on the event page are shortened. Hover shows the full path.
|
|
15
|
+
- The event count has thousands separators.
|
|
16
|
+
- The events-by-type chart uses ten distinct colours.
|
|
17
|
+
- Timeline offsets step through minutes, hours and days.
|
|
18
|
+
- The 24-hour chart starts on a whole hour.
|
|
19
|
+
|
|
3
20
|
## 0.4.1 (2026-10-03)
|
|
4
21
|
|
|
5
22
|
Added:
|
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
|
|
|
@@ -8,7 +8,7 @@ module RailsEventViewer
|
|
|
8
8
|
|
|
9
9
|
if analytics_supported?
|
|
10
10
|
@events_by_type = current_adapter.counts_by_name(limit: 10)
|
|
11
|
-
@events_over_time = current_adapter.events_over_time(range: 24.hours.ago.., interval: :hour)
|
|
11
|
+
@events_over_time = current_adapter.events_over_time(range: 24.hours.ago.beginning_of_hour.., interval: :hour)
|
|
12
12
|
else
|
|
13
13
|
@events_by_type = {}
|
|
14
14
|
@events_over_time = {}
|
|
@@ -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
|
|
|
@@ -58,12 +58,12 @@ module RailsEventViewer
|
|
|
58
58
|
def format_duration(seconds)
|
|
59
59
|
return "-" unless seconds
|
|
60
60
|
|
|
61
|
-
duration = ActiveSupport::Duration.build(seconds)
|
|
61
|
+
duration = ActiveSupport::Duration.build(seconds.round)
|
|
62
62
|
parts = duration.parts
|
|
63
63
|
|
|
64
64
|
return "0 seconds" if parts.empty? || parts == { seconds: 0 }
|
|
65
65
|
|
|
66
|
-
parts.map { |unit, value|
|
|
66
|
+
parts.first(2).map { |unit, value|
|
|
67
67
|
unit_name = value == 1 ? unit.to_s.singularize : unit.to_s
|
|
68
68
|
"#{value} #{unit_name}"
|
|
69
69
|
}.to_sentence
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
html: '<div id="%{id}" class="h-full w-full">%{loading}</div>',
|
|
56
56
|
content_for: nil,
|
|
57
57
|
donut: true,
|
|
58
|
-
colors: ["#4F46E5", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#EC4899", "#06B6D4", "#84CC16"] %>
|
|
58
|
+
colors: ["#4F46E5", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#EC4899", "#06B6D4", "#84CC16", "#64748B", "#92400E"] %>
|
|
59
59
|
<% else %>
|
|
60
60
|
<div class="flex items-center justify-center h-full text-gray-500">
|
|
61
61
|
No events to display
|
|
@@ -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 %>
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
<div class="px-6 py-4">
|
|
98
98
|
<dt class="text-sm font-medium text-gray-500">Source Location</dt>
|
|
99
99
|
<dd class="mt-1 text-sm text-gray-900">
|
|
100
|
-
<code class="bg-gray-100 px-2 py-1 rounded text-xs break-all">
|
|
101
|
-
<%=
|
|
100
|
+
<code class="bg-gray-100 px-2 py-1 rounded text-xs break-all" title="<%= filepath %>">
|
|
101
|
+
<%= event_short_filepath(@event) %>:<%= @event[:source_line] %>
|
|
102
102
|
</code>
|
|
103
103
|
<% label = @event[:source_label] %>
|
|
104
104
|
<% if label.present? %>
|
|
@@ -64,8 +64,12 @@
|
|
|
64
64
|
+<%= (offset * 1000).round %>ms
|
|
65
65
|
<% elsif offset < 60 %>
|
|
66
66
|
+<%= offset.round(1) %>s
|
|
67
|
+
<% elsif offset < 1.hour %>
|
|
68
|
+
+<%= (offset / 1.minute).round %>m
|
|
69
|
+
<% elsif offset < 1.day %>
|
|
70
|
+
+<%= (offset / 1.hour).round %>h
|
|
67
71
|
<% else %>
|
|
68
|
-
+<%= (offset /
|
|
72
|
+
+<%= (offset / 1.day).round %>d
|
|
69
73
|
<% end %>
|
|
70
74
|
</span>
|
|
71
75
|
</div>
|
|
@@ -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)
|