rails_performance 1.0.2 → 1.0.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/README.md +6 -2
- data/app/controllers/rails_performance/rails_performance_controller.rb +8 -1
- data/app/views/rails_performance/javascripts/app.js +27 -1
- data/app/views/rails_performance/rails_performance/_recent_row.html.erb +25 -0
- data/app/views/rails_performance/rails_performance/recent.html.erb +14 -27
- data/app/views/rails_performance/rails_performance/recent.js.erb +3 -0
- data/app/views/rails_performance/stylesheets/style.css +8 -1
- data/lib/rails_performance/gems/rake_ext.rb +9 -7
- data/lib/rails_performance/reports/recent_requests_report.rb +3 -3
- data/lib/rails_performance/version.rb +2 -2
- data/lib/rails_performance.rb +4 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da39e641dcac93526efb39f08e39cff972b5c09c04956b48bf1a30a6988fc24f
|
4
|
+
data.tar.gz: b7b0615aab822ec3742cc43ee74f45b63f1141cb79c246e4bc58c1d1b30b01f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ed2ae6cbd21422811df03088d04c036129ccf1bd527cf18964d6c1ff7c3781f7d5ab251041900a264ee89d7f0598b154f8426921f4cd3a5628a18b477580e6c
|
7
|
+
data.tar.gz: 55c864e62678514bf2b9c03cd648dfb8faa454d42061e8f454572c2d0083f367105540e0533c5b9efcd587e08dadabedc583fce842269aaa6b3659f26eb72d56
|
data/README.md
CHANGED
@@ -6,12 +6,13 @@
|
|
6
6
|
|
7
7
|
A self-hosted tool to monitor the performance of your Ruby on Rails application.
|
8
8
|
|
9
|
-
This is **simple and free alternative** to the New Relic APM, Datadog or other similar services.
|
9
|
+
This is a **simple and free alternative** to the New Relic APM, Datadog or other similar services.
|
10
10
|
|
11
11
|

|
12
12
|
|
13
13
|
It allows you to track:
|
14
14
|
|
15
|
+
- real-time monitoring on the Recent tab
|
15
16
|
- throughput report (see amount of RPM (requests per minute))
|
16
17
|
- an average response time
|
17
18
|
- the slowest controllers & actions
|
@@ -71,6 +72,8 @@ RailsPerformance.setup do |config|
|
|
71
72
|
|
72
73
|
# config home button link
|
73
74
|
config.home_link = '/'
|
75
|
+
|
76
|
+
config.skipable_rake_tasks = ['webpacker:compile']
|
74
77
|
end if defined?(RailsPerformance)
|
75
78
|
```
|
76
79
|
|
@@ -208,10 +211,11 @@ If "schema" how records are stored i Redis is changed, and this is a breacking c
|
|
208
211
|
- https://github.com/PedroAugustoRamalhoDuarte
|
209
212
|
- https://github.com/haffla
|
210
213
|
- https://github.com/D1ceWard
|
214
|
+
- https://github.com/carl-printreleaf
|
211
215
|
|
212
216
|
## License
|
213
217
|
|
214
218
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
215
219
|
|
216
220
|
[<img src="https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true"
|
217
|
-
/>](https://www.railsjazz.com
|
221
|
+
/>](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=rails_performance)
|
@@ -4,6 +4,8 @@ module RailsPerformance
|
|
4
4
|
class RailsPerformanceController < RailsPerformance::BaseController
|
5
5
|
include RailsPerformance::ApplicationHelper
|
6
6
|
|
7
|
+
protect_from_forgery except: :recent
|
8
|
+
|
7
9
|
if RailsPerformance.enabled
|
8
10
|
def index
|
9
11
|
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
@@ -51,7 +53,12 @@ module RailsPerformance
|
|
51
53
|
def recent
|
52
54
|
@datasource = RailsPerformance::DataSource.new(**prepare_query, type: :requests)
|
53
55
|
db = @datasource.db
|
54
|
-
@data = RailsPerformance::Reports::RecentRequestsReport.new(db).data
|
56
|
+
@data = RailsPerformance::Reports::RecentRequestsReport.new(db).data(params[:from_timei])
|
57
|
+
|
58
|
+
respond_to do |page|
|
59
|
+
page.html
|
60
|
+
page.js
|
61
|
+
end
|
55
62
|
end
|
56
63
|
|
57
64
|
def sidekiq
|
@@ -165,4 +165,30 @@ function showRTChart(div, data) {
|
|
165
165
|
}
|
166
166
|
}]
|
167
167
|
});
|
168
|
-
};
|
168
|
+
};
|
169
|
+
|
170
|
+
const recent = document.getElementById("recent")
|
171
|
+
const autoupdate = document.getElementById("autoupdate")
|
172
|
+
|
173
|
+
if(recent) {
|
174
|
+
const tbody = recent.querySelector("tbody")
|
175
|
+
|
176
|
+
setInterval(() => {
|
177
|
+
tr = tbody.children[0];
|
178
|
+
from_timei = tr.getAttribute("from_timei") || ''
|
179
|
+
|
180
|
+
if (!autoupdate.checked) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
fetch(`recent.js?from_timei=${from_timei}`, {
|
185
|
+
headers: {
|
186
|
+
"X-CSRF-Token": document.querySelector("[name='csrf-token']").content,
|
187
|
+
},
|
188
|
+
})
|
189
|
+
.then(res => res.text())
|
190
|
+
.then(html => {
|
191
|
+
tbody.innerHTML = html + tbody.innerHTML;
|
192
|
+
})
|
193
|
+
}, 3000);
|
194
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<tr from_timei="<%= e[:datetimei] %>">
|
2
|
+
<td>
|
3
|
+
<% if e[:request_id].present? %>
|
4
|
+
<%= link_to rails_performance.rails_performance_trace_path(id: e[:request_id]), remote: true do %>
|
5
|
+
<span class="stats_icon_max"><%= icon 'activity' %></span>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
8
|
+
</td>
|
9
|
+
<td><%= format_datetime e[:datetime] %></td>
|
10
|
+
<td><%= link_to e[:controller] + '#' + e[:action], rails_performance.rails_performance_summary_path({controller_eq: e[:controller], action_eq: e[:action]}), remote: true %></td>
|
11
|
+
<td><%= e[:method] %></td>
|
12
|
+
<td><%= e[:format] %></td>
|
13
|
+
<td><%= link_to_path(e) %></td>
|
14
|
+
<td><%= status_tag e[:status] %></td>
|
15
|
+
<td class="nowrap"><%= ms e[:duration] %></td>
|
16
|
+
<td class="nowrap"><%= ms e[:view_runtime] %></td>
|
17
|
+
<td class="nowrap"><%= ms e[:db_runtime] %></td>
|
18
|
+
<td>
|
19
|
+
<% if e[:request_id].present? %>
|
20
|
+
<%= link_to rails_performance.rails_performance_trace_path(id: e[:request_id]), remote: true do %>
|
21
|
+
<span class="stats_icon_max"><%= icon 'activity' %></span>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
@@ -2,9 +2,19 @@
|
|
2
2
|
|
3
3
|
<div class="card">
|
4
4
|
<div class="card-content">
|
5
|
-
<
|
5
|
+
<div class="columns">
|
6
|
+
<div class="column">
|
7
|
+
<h2 class="subtitle">Recent Requests (last <%= RailsPerformance::Reports::RecentRequestsReport::TIME_WINDOW / 60 %> minutes)<h2>
|
8
|
+
</div>
|
9
|
+
<div class="column right-text is-size-5 has-text-right">
|
10
|
+
<label id="autoupdate_label">
|
11
|
+
<input id="autoupdate" type="checkbox" checked/>
|
12
|
+
Auto-update
|
13
|
+
</label>
|
14
|
+
</div>
|
15
|
+
</div>
|
6
16
|
|
7
|
-
<table class="table is-fullwidth is-hoverable is-narrow">
|
17
|
+
<table id="recent" class="table is-fullwidth is-hoverable is-narrow">
|
8
18
|
<thead>
|
9
19
|
<tr>
|
10
20
|
<th data-sort="string"></th>
|
@@ -27,33 +37,10 @@
|
|
27
37
|
</tr>
|
28
38
|
<% end %>
|
29
39
|
<% @data.each do |e| %>
|
30
|
-
|
31
|
-
<td>
|
32
|
-
<% if e[:request_id].present? %>
|
33
|
-
<%= link_to rails_performance.rails_performance_trace_path(id: e[:request_id]), remote: true do %>
|
34
|
-
<span class="stats_icon_max"><%= icon 'activity' %></span>
|
35
|
-
<% end %>
|
36
|
-
<% end %>
|
37
|
-
</td>
|
38
|
-
<td><%= format_datetime e[:datetime] %></td>
|
39
|
-
<td><%= link_to e[:controller] + '#' + e[:action], rails_performance.rails_performance_summary_path({controller_eq: e[:controller], action_eq: e[:action]}), remote: true %></td>
|
40
|
-
<td><%= e[:method] %></td>
|
41
|
-
<td><%= e[:format] %></td>
|
42
|
-
<td><%= link_to_path(e) %></td>
|
43
|
-
<td><%= status_tag e[:status] %></td>
|
44
|
-
<td class="nowrap"><%= ms e[:duration] %></td>
|
45
|
-
<td class="nowrap"><%= ms e[:view_runtime] %></td>
|
46
|
-
<td class="nowrap"><%= ms e[:db_runtime] %></td>
|
47
|
-
<td>
|
48
|
-
<% if e[:request_id].present? %>
|
49
|
-
<%= link_to rails_performance.rails_performance_trace_path(id: e[:request_id]), remote: true do %>
|
50
|
-
<span class="stats_icon_max"><%= icon 'activity' %></span>
|
51
|
-
<% end %>
|
52
|
-
<% end %>
|
53
|
-
</td>
|
54
|
-
</tr>
|
40
|
+
<%= render 'recent_row', e: e %>
|
55
41
|
<% end %>
|
56
42
|
</tbody>
|
57
43
|
</table>
|
58
44
|
</div>
|
59
45
|
</div>
|
46
|
+
|
@@ -81,6 +81,9 @@
|
|
81
81
|
border-bottom: 1px solid red;
|
82
82
|
}
|
83
83
|
|
84
|
+
.card-content {
|
85
|
+
overflow-x: scroll;
|
86
|
+
}
|
84
87
|
|
85
88
|
table th[data-sort] {
|
86
89
|
cursor: pointer;
|
@@ -88,4 +91,8 @@ table th[data-sort] {
|
|
88
91
|
|
89
92
|
.very-small-text {
|
90
93
|
font-size: 8px;
|
91
|
-
}
|
94
|
+
}
|
95
|
+
|
96
|
+
#autoupdate_label {
|
97
|
+
cursor: pointer;
|
98
|
+
}
|
@@ -13,13 +13,15 @@ module RailsPerformance
|
|
13
13
|
status = 'error'
|
14
14
|
raise(ex)
|
15
15
|
ensure
|
16
|
-
RailsPerformance
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
if !RailsPerformance.skipable_rake_tasks.include?(self.name)
|
17
|
+
RailsPerformance::Models::RakeRecord.new(
|
18
|
+
task: RailsPerformance::Gems::RakeExt.find_task_name(*args),
|
19
|
+
datetime: now.strftime(RailsPerformance::FORMAT),
|
20
|
+
datetimei: now.to_i,
|
21
|
+
duration: (Time.now - now) * 1000,
|
22
|
+
status: status,
|
23
|
+
).save
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -7,11 +7,11 @@ module RailsPerformance
|
|
7
7
|
@sort ||= :datetimei
|
8
8
|
end
|
9
9
|
|
10
|
-
def data
|
11
|
-
time_agoi = TIME_WINDOW.ago.to_i
|
10
|
+
def data(from_timei = nil)
|
11
|
+
time_agoi = [TIME_WINDOW.ago.to_i, from_timei.to_i].reject(&:blank?).max
|
12
12
|
db.data
|
13
13
|
.collect{|e| e.record_hash}
|
14
|
-
.select{|e| e if e[sort]
|
14
|
+
.select{|e| e if e[sort] > time_agoi}
|
15
15
|
.sort{|a, b| b[sort] <=> a[sort]}
|
16
16
|
end
|
17
17
|
end
|
data/lib/rails_performance.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -164,6 +164,34 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: wrapped_print
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: puma
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
167
195
|
description: 3rd party dependency-free solution how to monitor performance of your
|
168
196
|
Rails applications.
|
169
197
|
email:
|
@@ -198,6 +226,7 @@ files:
|
|
198
226
|
- app/views/rails_performance/javascripts/stupidtable.min.js
|
199
227
|
- app/views/rails_performance/javascripts/table.js
|
200
228
|
- app/views/rails_performance/layouts/rails_performance.html.erb
|
229
|
+
- app/views/rails_performance/rails_performance/_recent_row.html.erb
|
201
230
|
- app/views/rails_performance/rails_performance/_summary.html.erb
|
202
231
|
- app/views/rails_performance/rails_performance/_trace.html.erb
|
203
232
|
- app/views/rails_performance/rails_performance/crashes.html.erb
|
@@ -207,6 +236,7 @@ files:
|
|
207
236
|
- app/views/rails_performance/rails_performance/index.html.erb
|
208
237
|
- app/views/rails_performance/rails_performance/rake.html.erb
|
209
238
|
- app/views/rails_performance/rails_performance/recent.html.erb
|
239
|
+
- app/views/rails_performance/rails_performance/recent.js.erb
|
210
240
|
- app/views/rails_performance/rails_performance/requests.html.erb
|
211
241
|
- app/views/rails_performance/rails_performance/sidekiq.html.erb
|
212
242
|
- app/views/rails_performance/rails_performance/summary.js.erb
|