rails_performance 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- 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 +4 -0
- data/lib/rails_performance/reports/recent_requests_report.rb +3 -3
- data/lib/rails_performance/version.rb +1 -1
- 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: b27b8bf73e30b04e7ae40afca4598b348457dcd09bbf30a2ca124e16caa2cf17
|
4
|
+
data.tar.gz: 36afe9bec764881de9cb6a29510903d7036ae80c8af072ea31018f8a85abbab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f974e6a2ee2ed369a9e73bccd64ae62c150ec2e6dd9324a41f880eaefc7063d309cc597a3a78db9f10d51214cf3949d6a7e784cc5b77b74082dc583913ab6cfd
|
7
|
+
data.tar.gz: 495d009f627564c2474dfecbd8b50d5b80f4b327fb5e18868443147a7327e1ca2d0ff078b5b8973583ab4aff52989a75213c6aa59d10e99a13b6562f2fd6f09a
|
data/README.md
CHANGED
@@ -12,6 +12,7 @@ This is **simple and free alternative** to the New Relic APM, Datadog or other s
|
|
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
|
@@ -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(`/rails/performance/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
|
+
|
@@ -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
|
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.3
|
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-05-
|
11
|
+
date: 2022-05-14 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
|