rails_event_viewer 0.4.0 → 0.4.2
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 +2 -0
- data/app/controllers/rails_event_viewer/dashboard_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 +2 -2
- data/app/views/rails_event_viewer/groups/show.html.erb +5 -1
- data/lib/generators/rails_event_viewer/install/templates/initializer.rb.erb +4 -0
- data/lib/rails_event_viewer/adapters/active_record.rb +3 -1
- data/lib/rails_event_viewer/version.rb +1 -1
- data/lib/rails_event_viewer.rb +1 -0
- 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: 2f0fbcd20727cc831799761717b5a0ef9a0976c62ca2452aea717000583d9ad5
|
|
4
|
+
data.tar.gz: 7e00df561d871f1d1df3de563f14c55bee8f0bcd006b6ce8b46db6b86bc7cb07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ac49e92ecd8fdf32706ca80986bb501d28ca8f9b6af3b12402501d120540e06281cf1f25c43420aaf8f4c3a721c49eef53d66f384e66bd4f4bf3f7ed3bb1f10
|
|
7
|
+
data.tar.gz: c8b0877b48cd334a30bd8345f9f9b9085227df835dd651e35c4ef0b63615ef4fbd466a2818bde6017469cc255e35d4ff63ebd9d349f7ea6bbffea3d4f9c258b3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 (2026-10-04)
|
|
4
|
+
|
|
5
|
+
Changed:
|
|
6
|
+
|
|
7
|
+
- Group durations are rounded and show only the two largest units.
|
|
8
|
+
- Source paths on the event page are shortened. Hover shows the full path.
|
|
9
|
+
- The event count has thousands separators.
|
|
10
|
+
- The events-by-type chart uses ten distinct colours.
|
|
11
|
+
- Timeline offsets step through minutes, hours and days.
|
|
12
|
+
- The 24-hour chart starts on a whole hour.
|
|
13
|
+
|
|
14
|
+
## 0.4.1 (2026-10-03)
|
|
15
|
+
|
|
16
|
+
Added:
|
|
17
|
+
|
|
18
|
+
- `config.transactional`, on by default. With `async = false`, set it to `false` so a failed event write does not abort the transaction caller's code is running in.
|
|
19
|
+
|
|
3
20
|
## 0.4.0 (2026-10-03)
|
|
4
21
|
|
|
5
22
|
Breaking:
|
data/README.md
CHANGED
|
@@ -60,6 +60,7 @@ RailsEventViewer.configure do |config|
|
|
|
60
60
|
config.buffer_size = 100 # flush after this many events
|
|
61
61
|
config.flush_interval = 2 # or after this many seconds
|
|
62
62
|
config.sample_rate = 1.0 # 0.1 keeps 10% of events
|
|
63
|
+
config.transactional = true # with async = false, a failed write aborts the transaction
|
|
63
64
|
|
|
64
65
|
config.captured_events = [] # empty captures everything
|
|
65
66
|
config.ignored_events += [/^debug\./] # strings or regexes
|
|
@@ -74,6 +75,7 @@ Internal Rails events such as `active_record.*` and `action_controller.*` are ig
|
|
|
74
75
|
## Sync vs async
|
|
75
76
|
|
|
76
77
|
- With `async = false`, each event is written inside your transaction, and a failed write is reported to `Rails.error`. In development and test, where Rails sets `raise_on_error`, it raises instead.
|
|
78
|
+
Sync writes are transactional by default, so a failed event write aborts the transaction on PostgreSQL. Set `transactional = false` to run each write in a savepoint instead.
|
|
77
79
|
- With `async = true`, events wait in an in-memory buffer and are lost if the process is killed. Set `config.buffer` to your own `RailsEventViewer::Buffer`, for example backed by Redis, to keep them.
|
|
78
80
|
|
|
79
81
|
## Authentication
|
|
@@ -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 = {}
|
|
@@ -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
|
|
@@ -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>
|
|
@@ -49,6 +49,10 @@ RailsEventViewer.configure do |config|
|
|
|
49
49
|
# Useful for high-volume production environments
|
|
50
50
|
# config.sample_rate = 1.0
|
|
51
51
|
|
|
52
|
+
# With async = false, events are written inside the transaction. By default a failed
|
|
53
|
+
# write aborts it. Set to false to run each write in a savepoint so host's own writes survive.
|
|
54
|
+
# config.transactional = true
|
|
55
|
+
|
|
52
56
|
# ==========================================================================
|
|
53
57
|
# General Configuration
|
|
54
58
|
# ==========================================================================
|
data/lib/rails_event_viewer.rb
CHANGED
|
@@ -14,6 +14,7 @@ module RailsEventViewer
|
|
|
14
14
|
mattr_accessor :buffer_size, default: 100 # Flush after N events
|
|
15
15
|
mattr_accessor :flush_interval, default: 2 # Flush every N seconds
|
|
16
16
|
mattr_accessor :sample_rate, default: 1.0 # 1.0 = 100%, 0.1 = 10%
|
|
17
|
+
mattr_accessor :transactional, default: true # false = a failed sync write does not abort the caller's transaction
|
|
17
18
|
mattr_accessor :buffer, default: Buffers::Memory.new
|
|
18
19
|
|
|
19
20
|
mattr_accessor :retention_period, default: 7.days
|