speedup-rails 0.0.7 → 0.0.9
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/speedup_rails/icons.png +0 -0
- data/app/helpers/speedup_rails/application_helper.rb +1 -0
- data/app/views/speedup_rails/collectors/_bullet.html.erb +4 -1
- data/app/views/speedup_rails/collectors/_partials.html.erb +18 -10
- data/app/views/speedup_rails/collectors/_queries.html.erb +22 -1
- data/app/views/speedup_rails/collectors/_request.html.erb +12 -3
- data/app/views/speedup_rails/results/show.html.erb +2 -2
- data/lib/speedup/collectors/collector.rb +4 -0
- data/lib/speedup/collectors/queries_collector.rb +1 -1
- data/lib/speedup/collectors/rubyprof_collector.rb +1 -1
- data/lib/speedup/middleware.rb +35 -10
- data/lib/speedup/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a79adaf0346b1581840b1cbc3d88f33e31f31b0e
|
4
|
+
data.tar.gz: 877452dc9f81628257b2e844c0f6a53025d368bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d94ee85e7b3efbd8461ccb7b78bf86b871a115d5437cd488874b1337a5cebb25347cabb88c2d5f0cfb145373b3bf6575e798dca1b659bd066d450ecf28867e9
|
7
|
+
data.tar.gz: 8a626e5ceb3d20502ddcc69d9fb1e1985bbd160eacd6779720f95be6ac39a95e011326ea3480f72a8bc35d9fea070afa4f7daa9f47ff2719db9f916dd22b213a
|
Binary file
|
@@ -1,5 +1,8 @@
|
|
1
|
+
<div class="icon_container">
|
2
|
+
<%= image_tag('speedup_rails/icons.png', alt: '', style: 'clip: rect(0, 20px, 20px, 0px); left: 0;') %>
|
3
|
+
</div>
|
1
4
|
<span class="speedup_rails_<%= key %>" data-key="<%= key %>">
|
2
|
-
<%=
|
5
|
+
<%= data.count %> problems
|
3
6
|
</span>
|
4
7
|
<% if data.any? %>
|
5
8
|
<div class="additional_info">
|
@@ -1,13 +1,21 @@
|
|
1
|
+
<div class="icon_container">
|
2
|
+
<%= image_tag('speedup_rails/icons.png', alt: '', style: 'clip: rect(0, 60px, 20px, 40px); left: -40px;') %>
|
3
|
+
</div>
|
1
4
|
<span class="speedup_rails_<%= key %>" data-key="<%= key %>">
|
2
|
-
<%=
|
5
|
+
<%= data.count %> partials
|
6
|
+
<% unless redirect %>
|
7
|
+
(<%= render_ms(request_data[:view_duration]) %>)
|
8
|
+
<% end %>
|
3
9
|
</span>
|
4
|
-
|
5
|
-
<div class="
|
6
|
-
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
<% if data.any? %>
|
11
|
+
<div class="additional_info">
|
12
|
+
<div class="partials">
|
13
|
+
<% data.each do |template| %>
|
14
|
+
<div>
|
15
|
+
<span class="duration <%= template[:duration] > 100 ? 'duration-warning' : 'duration-info' %>"><%= render_ms(template[:duration]) %></span>
|
16
|
+
<span class="template"><%= template[:identifier] %></span>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
12
20
|
</div>
|
13
|
-
|
21
|
+
<% end %>
|
@@ -1,5 +1,8 @@
|
|
1
|
+
<div class="icon_container">
|
2
|
+
<%= image_tag('speedup_rails/icons.png', alt: '', style: 'clip: rect(0, 40px, 20px, 20px); left: -20px;') %>
|
3
|
+
</div>
|
1
4
|
<span class="speedup_rails_<%= key %>" data-key="<%= key %>">
|
2
|
-
<%=
|
5
|
+
<%= data.count %> queries (<%= render_ms(data.sum{|t| t[:duration] }) %>)
|
3
6
|
</span>
|
4
7
|
<div class="additional_info">
|
5
8
|
<div class="queries">
|
@@ -7,7 +10,25 @@
|
|
7
10
|
<div>
|
8
11
|
<span class="duration <%= query[:duration] > 10 ? 'duration-warning' : 'duration-info' %>"><%= render_ms(query[:duration])%></span>
|
9
12
|
<span class="query"><%= query[:query] %></span>
|
13
|
+
<div class="backtrace">
|
14
|
+
<% query[:backtrace].each do |line| %>
|
15
|
+
<span class="backtrace_line"><%= line %><br/></span>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
10
18
|
</div>
|
11
19
|
<% end %>
|
12
20
|
</div>
|
13
21
|
</div>
|
22
|
+
|
23
|
+
<script type="text/javascript">
|
24
|
+
var traces = document.getElementById("speedup_collectorinfo_<%= key %>").getElementsByClassName('backtrace')
|
25
|
+
for (var j = traces.length - 1; j >= 0; j--) {
|
26
|
+
traces[j].onclick = function() {
|
27
|
+
var i;
|
28
|
+
var x = this.getElementsByClassName("backtrace_line");
|
29
|
+
for (i = 0; i < x.length; i++) {
|
30
|
+
x[i].style.display = "inline";
|
31
|
+
}
|
32
|
+
};
|
33
|
+
};
|
34
|
+
</script>
|
@@ -1,5 +1,14 @@
|
|
1
|
+
<div class="icon_container">
|
2
|
+
<%= image_tag('speedup_rails/icons.png', alt: '', style: 'clip: rect(0, 80px, 20px, 60px); left: -60px;') %>
|
3
|
+
</div>
|
1
4
|
<span class="speedup_rails_<%= key %>" data-key="<%= key %>">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
+
<%= data[:controller] %>#<%= data[:action] %>
|
6
|
+
</span>
|
7
|
+
</li>
|
8
|
+
<li id="speedup_collectorinfo_request2">
|
9
|
+
<div class="icon_container">
|
10
|
+
<%= image_tag('speedup_rails/icons.png', alt: '', style: 'clip: rect(0, 100px, 20px, 80px); left: -80px;') %>
|
11
|
+
</div>
|
12
|
+
<span class="speedup_rails_<%= key %>" data-key="<%= key %>">
|
13
|
+
<%= (data[:duration] * 100).round.to_f / 100 %> ms
|
5
14
|
</span>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<ul class="speedup_main_bar speedup_main_bar_<%= @redirect %><%= ' redirect' if @redirect %>">
|
2
2
|
<% @collectors.each do |col| %>
|
3
3
|
<% next unless col.render? %>
|
4
|
-
<li>
|
5
|
-
<%= render "speedup_rails/collectors/#{col.key}", data: @request[col.key] || [], key: col.key, request_data: @request[:request] %>
|
4
|
+
<li id="speedup_collectorinfo_<%= col.key %>">
|
5
|
+
<%= render "speedup_rails/collectors/#{col.key}", data: @request[col.key] || [], key: col.key, request_data: @request[:request], redirect: @redirect %>
|
6
6
|
</li>
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
@@ -12,7 +12,7 @@ module Speedup
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def event_to_data(evt)
|
15
|
-
{time: evt.time, duration: evt.duration, name: evt.payload[:name], query: evt.payload[:sql]}
|
15
|
+
{time: evt.time, duration: evt.duration, name: evt.payload[:name], query: evt.payload[:sql], backtrace: clean_trace}
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -29,7 +29,7 @@ module Speedup
|
|
29
29
|
result = RubyProf.stop if enabled?
|
30
30
|
|
31
31
|
# Print a flat profile to text
|
32
|
-
printer = RubyProf::
|
32
|
+
printer = RubyProf::CallStackPrinter.new(result)
|
33
33
|
::File.open(@results_dir.join( Speedup.request.id ), 'wb') do |file|
|
34
34
|
printer.print(file)
|
35
35
|
end
|
data/lib/speedup/middleware.rb
CHANGED
@@ -86,6 +86,12 @@ module Speedup
|
|
86
86
|
@redirects.each_with_index do |req_id, idx|
|
87
87
|
str << " loadRequestData('#{SpeedupRails::Engine.routes.url_helpers.result_path(req_id, redirect: idx)}');"
|
88
88
|
end
|
89
|
+
str << "if( typeof jQuery !== 'undefined' ) {
|
90
|
+
jQuery(document).ajaxComplete(function(evt, xhr, settings){
|
91
|
+
if(! settings.url.match('#{SpeedupRails::Engine.routes.url_helpers.result_path('')}') )
|
92
|
+
loadRequestData('#{SpeedupRails::Engine.routes.url_helpers.result_path('REQUEST_ID')}'.replace('REQUEST_ID', xhr.getResponseHeader('X-Request-Id')));
|
93
|
+
});
|
94
|
+
}"
|
89
95
|
str << '</script>'
|
90
96
|
str
|
91
97
|
end
|
@@ -100,7 +106,7 @@ module Speedup
|
|
100
106
|
bottom: 5px;
|
101
107
|
right: 5px;
|
102
108
|
min-width: 250px;
|
103
|
-
z-index:
|
109
|
+
z-index: 8;
|
104
110
|
}
|
105
111
|
#speedup_rails_bar .redirect {
|
106
112
|
color: #444;
|
@@ -115,8 +121,17 @@ module Speedup
|
|
115
121
|
overflow: auto;
|
116
122
|
font: normal normal 12px/21px Tahoma, sans-serif;
|
117
123
|
}
|
118
|
-
#speedup_rails_bar > ul {
|
119
|
-
|
124
|
+
#speedup_rails_bar > ul.speedup_main_bar {
|
125
|
+
list-style: none;
|
126
|
+
clear: left;
|
127
|
+
margin: 0;
|
128
|
+
padding: 0;
|
129
|
+
margin-left: 4px;
|
130
|
+
overflow: visible;
|
131
|
+
position: relative;
|
132
|
+
height: 22px;
|
133
|
+
}
|
134
|
+
#speedup_rails_bar > ul > li { float: left; padding-left: 5px; }
|
120
135
|
#speedup_rails_bar .additional_info {
|
121
136
|
position: absolute;
|
122
137
|
bottom: 100%;
|
@@ -124,15 +139,17 @@ module Speedup
|
|
124
139
|
padding: 5px;
|
125
140
|
display: none;
|
126
141
|
height: 500px;
|
142
|
+
max-width: 200%;
|
143
|
+
overflow: scroll;
|
127
144
|
}
|
128
|
-
#speedup_rails_bar > ul > li:hover .additional_info { display: block;
|
129
|
-
#speedup_rails_bar li > span { padding: 0
|
130
|
-
#speedup_rails_bar
|
131
|
-
vertical-align: middle;
|
145
|
+
#speedup_rails_bar > ul > li:hover .additional_info { display: block; }
|
146
|
+
#speedup_rails_bar li > span { padding: 0 2px; margin-left: 20px; }
|
147
|
+
#speedup_rails_bar .icon_container {
|
132
148
|
position: relative;
|
133
|
-
|
134
|
-
|
135
|
-
|
149
|
+
}
|
150
|
+
#speedup_rails_bar .icon_container img {
|
151
|
+
position: absolute;
|
152
|
+
max-width: 100px;
|
136
153
|
}
|
137
154
|
#speedup_rails_bar .additional_info > div > div {
|
138
155
|
border-bottom: 1px solid #c9c9c9;
|
@@ -146,6 +163,14 @@ module Speedup
|
|
146
163
|
#speedup_rails_bar .additional_info .duration.duration-warning {
|
147
164
|
color: red;
|
148
165
|
}
|
166
|
+
#speedup_rails_bar .additional_info .backtrace {
|
167
|
+
font-size: 95%;
|
168
|
+
margin: 5px 0 0 20px;
|
169
|
+
line-height: 1.4em;
|
170
|
+
}
|
171
|
+
#speedup_rails_bar .additional_info .backtrace .backtrace_line:not(:first-child) {
|
172
|
+
display: none;
|
173
|
+
}
|
149
174
|
</style>
|
150
175
|
END_STYLES
|
151
176
|
end
|
data/lib/speedup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speedup-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- app/assets/images/speedup_rails/alert.jpg
|
177
177
|
- app/assets/images/speedup_rails/database.png
|
178
178
|
- app/assets/images/speedup_rails/file-icon.png
|
179
|
+
- app/assets/images/speedup_rails/icons.png
|
179
180
|
- app/assets/images/speedup_rails/input.png
|
180
181
|
- app/assets/images/speedup_rails/time.png
|
181
182
|
- app/assets/javascripts/speedup_rails/application.js
|