rails_performance 0.0.1.10 → 0.0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/home.svg +16 -0
- data/app/controllers/rails_performance_controller.rb +10 -13
- data/app/helpers/rails_performance_helper.rb +21 -2
- data/app/views/rails_performance/breakdown.html.erb +7 -13
- data/app/views/rails_performance/crashes.html.erb +8 -14
- data/app/views/rails_performance/recent.html.erb +6 -12
- data/app/views/rails_performance/requests.html.erb +10 -10
- data/app/views/shared/_header.html.erb +3 -0
- data/app/views/stylesheets/style.css +5 -0
- data/lib/rails_performance/reports/requests_report.rb +1 -1
- data/lib/rails_performance/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939d826d3e398d89839a7bbdd673fbeb1b89bfdbb27ff8b0a096c2bb236096ba
|
4
|
+
data.tar.gz: 579db652ed8fe43d1c91284ab07b9f4668f9aa79a87cd40a65f1b290f71d7da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f15e0fcc4ecd75401140e69f37e2a7fae382392ca5890ba5d5c7fb4194d4888662fc04e2575b6f1f8565a60a0fe42d0635915ea343e70ddae6efb9deec99c863
|
7
|
+
data.tar.gz: 538a65badcc5daec51f971be14962b543abd62c718e7bbd1e630304b1e306aae5df47b9be1260108c4a7733352bac91a0b623479e8ef6dfb8a2c62ab4f563fd2
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" ?><svg height="48" id="home" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><defs><style>
|
2
|
+
.vi-primary {
|
3
|
+
fill: #FF6E6E;
|
4
|
+
}
|
5
|
+
|
6
|
+
.vi-primary, .vi-accent {
|
7
|
+
stroke: #fff;
|
8
|
+
stroke-linecap: round;
|
9
|
+
stroke-width: 0;
|
10
|
+
fill-rule: evenodd;
|
11
|
+
}
|
12
|
+
|
13
|
+
.vi-accent {
|
14
|
+
fill: #0C0058;
|
15
|
+
}
|
16
|
+
</style></defs><path class="vi-primary" d="M5,24L24,5,43,24H38V40H10V24H5Z"/><path class="vi-accent" d="M19,40V26H29V40H19Z"/></svg>
|
@@ -12,32 +12,29 @@ class RailsPerformanceController < ActionController::Base
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def crashes
|
15
|
-
@datasource
|
16
|
-
db
|
17
|
-
@
|
18
|
-
@
|
15
|
+
@datasource = RP::DataSource.new(prepare_query({status_eq: 500}))
|
16
|
+
db = @datasource.db
|
17
|
+
@report = RP::Reports::CrashReport.new(db)
|
18
|
+
@data = @report.data
|
19
19
|
end
|
20
20
|
|
21
21
|
def requests
|
22
|
-
@datasource
|
23
|
-
db
|
24
|
-
|
25
|
-
@
|
26
|
-
@global_report_data = @global_report.data
|
22
|
+
@datasource = RP::DataSource.new(prepare_query)
|
23
|
+
db = @datasource.db
|
24
|
+
@report = RP::Reports::RequestsReport.new(db, group: :controller_action_format, sort: :count)
|
25
|
+
@data = @report.data
|
27
26
|
end
|
28
27
|
|
29
28
|
def breakdown
|
30
29
|
@datasource = RP::DataSource.new(prepare_query)
|
31
30
|
db = @datasource.db
|
32
|
-
|
33
|
-
@
|
34
|
-
@breakdown_report_data = @breakdown_report.data
|
31
|
+
@report = RP::Reports::BreakdownReport.new(db, title: "Breakdown Report")
|
32
|
+
@data = @report.data
|
35
33
|
end
|
36
34
|
|
37
35
|
def recent
|
38
36
|
@datasource = RP::DataSource.new(prepare_query)
|
39
37
|
db = @datasource.db
|
40
|
-
|
41
38
|
@report = RP::Reports::RecentRequestsReport.new(db)
|
42
39
|
@data = @report.data
|
43
40
|
end
|
@@ -6,6 +6,25 @@ module RailsPerformanceHelper
|
|
6
6
|
value.nan? ? nil : value.round(2)
|
7
7
|
end
|
8
8
|
|
9
|
+
def ms(value)
|
10
|
+
result = round_it(value)
|
11
|
+
result ? "#{result} ms" : '-'
|
12
|
+
end
|
13
|
+
|
14
|
+
def short_path(path, length: 60)
|
15
|
+
tag.span title: path do
|
16
|
+
truncate(path, length: length)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def link_to_path(e)
|
21
|
+
if e[:method] == 'GET'
|
22
|
+
link_to short_path(e[:path]), e[:path], target: '_blank'
|
23
|
+
else
|
24
|
+
short_path(e[:path])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
9
28
|
def statistics_link(title, report, group)
|
10
29
|
options = case report.group
|
11
30
|
when :controller_action_format
|
@@ -41,9 +60,9 @@ module RailsPerformanceHelper
|
|
41
60
|
end
|
42
61
|
end
|
43
62
|
|
44
|
-
def
|
63
|
+
def icon(name)
|
45
64
|
# https://www.iconfinder.com/iconsets/vivid
|
46
|
-
raw File.read(File.expand_path(File.dirname(__FILE__) + "/../assets/images
|
65
|
+
raw File.read(File.expand_path(File.dirname(__FILE__) + "/../assets/images/#{name}.svg"))
|
47
66
|
end
|
48
67
|
|
49
68
|
def insert_css_file(file)
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<title><%= @
|
1
|
+
<title><%= @report.title %></title>
|
2
2
|
|
3
3
|
<div class="card">
|
4
4
|
<div class="card-content">
|
5
|
-
<h2 class="subtitle"><%= @
|
5
|
+
<h2 class="subtitle"><%= @report.title %></h2>
|
6
6
|
<table class="table is-fullwidth is-hoverable is-narrow">
|
7
7
|
<thead>
|
8
8
|
<tr>
|
@@ -18,23 +18,17 @@
|
|
18
18
|
</tr>
|
19
19
|
</thead>
|
20
20
|
<tbody>
|
21
|
-
<% @
|
21
|
+
<% @data.each do |e| %>
|
22
22
|
<tr>
|
23
23
|
<td><%= l e[:datetime], format: :short %></td>
|
24
24
|
<td><%= e[:controller] + '#' + e[:action] %></td>
|
25
25
|
<td><%= e[:method] %></td>
|
26
|
-
<td>
|
27
|
-
<% if e[:method] == 'GET' %>
|
28
|
-
<%= link_to e[:path], e[:path], target: '_blank' %>
|
29
|
-
<% else %>
|
30
|
-
<%= e[:path] %>
|
31
|
-
<% end %>
|
32
|
-
</td>
|
26
|
+
<td><%= link_to_path(e) %></td>
|
33
27
|
<td><%= e[:format] %></td>
|
34
28
|
<td><%= status_tag e[:status] %></td>
|
35
|
-
<td><%=
|
36
|
-
<td><%=
|
37
|
-
<td><%=
|
29
|
+
<td><%= ms e[:duration] %></td>
|
30
|
+
<td><%= ms e[:view_runtime] %></td>
|
31
|
+
<td><%= ms e[:db_runtime] %></td>
|
38
32
|
</tr>
|
39
33
|
<% end %>
|
40
34
|
</tbody>
|
@@ -6,8 +6,8 @@
|
|
6
6
|
<tr>
|
7
7
|
<th>Datetime</th>
|
8
8
|
<th>Controller#Action</th>
|
9
|
-
<th>Format</th>
|
10
9
|
<th>Method</th>
|
10
|
+
<th>Format</th>
|
11
11
|
<th>Path</th>
|
12
12
|
<th>Status</th>
|
13
13
|
<th>Duration</th>
|
@@ -16,23 +16,17 @@
|
|
16
16
|
</tr>
|
17
17
|
</thead>
|
18
18
|
<tbody>
|
19
|
-
<% @
|
19
|
+
<% @data.each do |e| %>
|
20
20
|
<tr>
|
21
|
-
<td><%=
|
21
|
+
<td><%= format_datetime e[:datetime] %></td>
|
22
22
|
<td><%= e[:controller] + '#' + e[:action] %></td>
|
23
|
-
<td><%= e[:format] %></td>
|
24
23
|
<td><%= e[:method] %></td>
|
25
|
-
<td>
|
26
|
-
|
27
|
-
<%= link_to e[:path], e[:path], target: '_blank' %>
|
28
|
-
<% else %>
|
29
|
-
<%= e[:path] %>
|
30
|
-
<% end %>
|
31
|
-
</td>
|
24
|
+
<td><%= e[:format] %></td>
|
25
|
+
<td><%= link_to_path(e) %></td>
|
32
26
|
<td><%= status_tag e[:status] %></td>
|
33
|
-
<td><%=
|
34
|
-
<td><%=
|
35
|
-
<td><%=
|
27
|
+
<td><%= ms e[:duration] %></td>
|
28
|
+
<td><%= ms e[:view_runtime] %></td>
|
29
|
+
<td><%= ms e[:db_runtime] %></td>
|
36
30
|
</tr>
|
37
31
|
<% end %>
|
38
32
|
</tbody>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<tr>
|
9
9
|
<th>Datetime</th>
|
10
10
|
<th>Controller#Action</th>
|
11
|
-
<th>Format</th>
|
12
11
|
<th>Method</th>
|
12
|
+
<th>Format</th>
|
13
13
|
<th>Path</th>
|
14
14
|
<th>Status</th>
|
15
15
|
<th>Duration</th>
|
@@ -22,19 +22,13 @@
|
|
22
22
|
<tr>
|
23
23
|
<td><%= format_datetime e[:datetime] %></td>
|
24
24
|
<td><%= e[:controller] + '#' + e[:action] %></td>
|
25
|
-
<td><%= e[:format] %></td>
|
26
25
|
<td><%= e[:method] %></td>
|
27
|
-
<td>
|
28
|
-
|
29
|
-
<%= link_to e[:path], e[:path], target: '_blank' %>
|
30
|
-
<% else %>
|
31
|
-
<%= e[:path] %>
|
32
|
-
<% end %>
|
33
|
-
</td>
|
26
|
+
<td><%= e[:format] %></td>
|
27
|
+
<td><%= link_to_path(e) %></td>
|
34
28
|
<td><%= status_tag e[:status] %></td>
|
35
|
-
<td><%=
|
36
|
-
<td><%=
|
37
|
-
<td><%=
|
29
|
+
<td><%= ms e[:duration] %></td>
|
30
|
+
<td><%= ms e[:view_runtime] %></td>
|
31
|
+
<td><%= ms e[:db_runtime] %></td>
|
38
32
|
</tr>
|
39
33
|
<% end %>
|
40
34
|
</tbody>
|
@@ -21,24 +21,24 @@
|
|
21
21
|
</tr>
|
22
22
|
</thead>
|
23
23
|
<tbody>
|
24
|
-
<% @
|
24
|
+
<% @data.each do |e| %>
|
25
25
|
<% groups = e[:group].split("|") %>
|
26
26
|
<% c, a = groups[0].split("#") %>
|
27
27
|
<tr>
|
28
28
|
<td>
|
29
|
-
<%= statistics_link groups[0], @
|
29
|
+
<%= statistics_link groups[0], @report, e[:group] %>
|
30
30
|
<%= link_to rails_performance.rails_performance_breakdown_path(controller_eq: c, action_eq: a), class: 'stats_icon', target: '_blank' do %>
|
31
|
-
<%=
|
31
|
+
<%= icon("stat") %>
|
32
32
|
<% end %>
|
33
33
|
</td>
|
34
|
-
<td><%= statistics_link groups[1]&.upcase, @
|
34
|
+
<td><%= statistics_link groups[1]&.upcase, @report, e[:group] %></td>
|
35
35
|
<td><%= e[:count] %></td>
|
36
|
-
<td><%=
|
37
|
-
<td><%=
|
38
|
-
<td><%=
|
39
|
-
<td><%=
|
40
|
-
<td><%=
|
41
|
-
<td><%=
|
36
|
+
<td><%= ms e[:duration_average] %></td>
|
37
|
+
<td><%= ms e[:view_runtime_average] %></td>
|
38
|
+
<td><%= ms e[:db_runtime_average] %></td>
|
39
|
+
<td><%= ms e[:duration_slowest] %></td>
|
40
|
+
<td><%= ms e[:view_runtime_slowest] %></td>
|
41
|
+
<td><%= ms e[:db_runtime_slowest] %></td>
|
42
42
|
</tr>
|
43
43
|
<% end %>
|
44
44
|
</tbody>
|
@@ -26,6 +26,9 @@
|
|
26
26
|
<div class="buttons">
|
27
27
|
<%#= link_to 'Export to CSV', '#', target: '_blank', class: "button is-primary" %>
|
28
28
|
<%= link_to 'Documentation', 'https://github.com/igorkasyanchuk/rails_performance', target: '_blank', class: "button is-light" %>
|
29
|
+
<%= link_to '/', target: '_blank', class: "button is-light home_icon" do %>
|
30
|
+
<%= icon('home') %>
|
31
|
+
<% end %>
|
29
32
|
</div>
|
30
33
|
</div>
|
31
34
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- README.md
|
92
92
|
- Rakefile
|
93
93
|
- app/assets/config/rails_performance_manifest.js
|
94
|
+
- app/assets/images/home.svg
|
94
95
|
- app/assets/images/stat.svg
|
95
96
|
- app/controllers/rails_performance_controller.rb
|
96
97
|
- app/helpers/rails_performance_helper.rb
|