rack-mini-profiler 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack-mini-profiler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Ruby/CHANGELOG +4 -0
- data/Ruby/README.md +1 -1
- data/Ruby/lib/html/includes.tmpl +2 -0
- data/Ruby/lib/mini_profiler/client_settings.rb +11 -11
- data/Ruby/lib/mini_profiler/page_timer_struct.rb +4 -4
- data/Ruby/lib/mini_profiler/profiler.rb +3 -0
- data/Ruby/lib/mini_profiler/profiling_methods.rb +31 -11
- data/Ruby/lib/mini_profiler/request_timer_struct.rb +5 -5
- data/Ruby/lib/mini_profiler/version.rb +1 -1
- data/rack-mini-profiler.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88d14211a1bd6e204377a0405f364fa9069029f0
|
4
|
+
data.tar.gz: 0c96e6d8d1df58cdd879319063e203efa846bd9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f681b1fe0dedcbd7ec6dc43f31cc0eb6d7dd78c0c69ae0b6bd040df166450a833a7f987c7d0167f2e54b30c37323bc99f48440078ad59052b852567a4d6ff442
|
7
|
+
data.tar.gz: dccb1eec80365ab26fd439d280ccc03fe3f0c9c72d193df117c1392b8f338abb4fbb72f676217c5ae5cd47bfb66a8249b4f7a6e244dcf1df7cd322bbff36c2d1
|
data/Ruby/CHANGELOG
CHANGED
@@ -148,5 +148,9 @@
|
|
148
148
|
* Bugfix: SOLR patching had an incorrect monkey patch
|
149
149
|
* Implemented exception tracing using TracePoint see pp=trace-exceptions
|
150
150
|
|
151
|
+
30-August-2013
|
151
152
|
|
153
|
+
* 1.30
|
154
|
+
* Feature: Added Rack::MiniProfiler.counter_method(klass,name) for injecting counters
|
155
|
+
* Bug: Counters were not shifting the table correctly
|
152
156
|
|
data/Ruby/README.md
CHANGED
@@ -153,7 +153,7 @@ end
|
|
153
153
|
|
154
154
|
## Notes
|
155
155
|
|
156
|
-
- Be sure to require rack_mini_profiler last in your Gemfile, when it is required it will monkey patch pg and mysql gems to insert instrumentation. If included
|
156
|
+
- Be sure to require rack_mini_profiler last in your Gemfile, when it is required it will monkey patch pg and mysql gems to insert instrumentation. If included too early no SQL will show up.
|
157
157
|
|
158
158
|
## Available Options
|
159
159
|
|
data/Ruby/lib/html/includes.tmpl
CHANGED
@@ -159,6 +159,8 @@
|
|
159
159
|
<td class="profiler-duration" title="aggregate duration of all queries in this step (excludes children)">
|
160
160
|
${MiniProfiler.formatDuration(timing.SqlTimingsDurationMilliseconds)}
|
161
161
|
</td>
|
162
|
+
{{else}}
|
163
|
+
<td colspan="2"></td>
|
162
164
|
{{/if}}
|
163
165
|
|
164
166
|
{{each page.CustomTimingNames}}
|
@@ -1,20 +1,20 @@
|
|
1
1
|
module Rack
|
2
2
|
class MiniProfiler
|
3
3
|
class ClientSettings
|
4
|
-
|
4
|
+
|
5
5
|
COOKIE_NAME = "__profilin"
|
6
6
|
|
7
7
|
BACKTRACE_DEFAULT = nil
|
8
|
-
BACKTRACE_FULL = 1
|
8
|
+
BACKTRACE_FULL = 1
|
9
9
|
BACKTRACE_NONE = 2
|
10
10
|
|
11
11
|
attr_accessor :disable_profiling
|
12
12
|
attr_accessor :backtrace_level
|
13
13
|
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(env)
|
16
16
|
request = ::Rack::Request.new(env)
|
17
|
-
@cookie = request.cookies[COOKIE_NAME]
|
17
|
+
@cookie = request.cookies[COOKIE_NAME]
|
18
18
|
if @cookie
|
19
19
|
@cookie.split(",").map{|pair| pair.split("=")}.each do |k,v|
|
20
20
|
@orig_disable_profiling = @disable_profiling = (v=='t') if k == "dp"
|
@@ -22,7 +22,7 @@ module Rack
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
@backtrace_level = nil if !@backtrace_level.nil? && (@backtrace_level == 0 || @backtrace_level > BACKTRACE_NONE)
|
25
|
+
@backtrace_level = nil if !@backtrace_level.nil? && (@backtrace_level == 0 || @backtrace_level > BACKTRACE_NONE)
|
26
26
|
@orig_backtrace_level = @backtrace_level
|
27
27
|
|
28
28
|
end
|
@@ -30,7 +30,7 @@ module Rack
|
|
30
30
|
def write!(headers)
|
31
31
|
if @orig_disable_profiling != @disable_profiling || @orig_backtrace_level != @backtrace_level || @cookie.nil?
|
32
32
|
settings = {"p" => "t" }
|
33
|
-
settings["dp"] = "t" if @disable_profiling
|
33
|
+
settings["dp"] = "t" if @disable_profiling
|
34
34
|
settings["bt"] = @backtrace_level if @backtrace_level
|
35
35
|
settings_string = settings.map{|k,v| "#{k}=#{v}"}.join(",")
|
36
36
|
Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, :value => settings_string, :path => '/')
|
@@ -45,19 +45,19 @@ module Rack
|
|
45
45
|
!@cookie.nil?
|
46
46
|
end
|
47
47
|
|
48
|
-
def disable_profiling?
|
48
|
+
def disable_profiling?
|
49
49
|
@disable_profiling
|
50
50
|
end
|
51
51
|
|
52
|
-
def backtrace_full?
|
52
|
+
def backtrace_full?
|
53
53
|
@backtrace_level == BACKTRACE_FULL
|
54
54
|
end
|
55
55
|
|
56
|
-
def backtrace_default?
|
56
|
+
def backtrace_default?
|
57
57
|
@backtrace_level == BACKTRACE_DEFAULT
|
58
58
|
end
|
59
|
-
|
60
|
-
def backtrace_none?
|
59
|
+
|
60
|
+
def backtrace_none?
|
61
61
|
@backtrace_level == BACKTRACE_NONE
|
62
62
|
end
|
63
63
|
end
|
@@ -43,16 +43,16 @@ module Rack
|
|
43
43
|
def root
|
44
44
|
@attributes['Root']
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def to_json(*a)
|
48
48
|
attribs = @attributes.merge(
|
49
|
-
"Started" => '/Date(%d)/' % @attributes['Started'],
|
49
|
+
"Started" => '/Date(%d)/' % @attributes['Started'],
|
50
50
|
"DurationMilliseconds" => @attributes['Root']['DurationMilliseconds'],
|
51
51
|
"CustomTimingNames" => @attributes['CustomTimingStats'].keys.sort
|
52
|
-
)
|
52
|
+
)
|
53
53
|
::JSON.generate(attribs, :max_nesting => 100)
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
end
|
58
58
|
end
|
@@ -450,6 +450,9 @@ module Rack
|
|
450
450
|
body << "#{k}: #{v}\n"
|
451
451
|
end
|
452
452
|
|
453
|
+
body << "\n\nRuby Version\n---------------\n"
|
454
|
+
body << "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL}\n"
|
455
|
+
|
453
456
|
body << "\n\nInternals\n---------------\n"
|
454
457
|
body << "Storage Provider #{config.storage_instance}\n"
|
455
458
|
body << "User #{user(env)}\n"
|
@@ -55,8 +55,16 @@ module Rack
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
59
|
-
|
58
|
+
def counter_method(klass, method, &blk)
|
59
|
+
self.profile_method(klass, method, :counter, &blk)
|
60
|
+
end
|
61
|
+
|
62
|
+
def uncounter_method(klass, method)
|
63
|
+
self.unprofile_method(klass, method)
|
64
|
+
end
|
65
|
+
|
66
|
+
def profile_method(klass, method, type = :profile, &blk)
|
67
|
+
default_name = type==:counter ? method.to_s : klass.to_s + " " + method.to_s
|
60
68
|
clean = clean_method_name(method)
|
61
69
|
|
62
70
|
with_profiling = ("#{clean}_with_mini_profiler").intern
|
@@ -81,22 +89,34 @@ module Rack
|
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
84
|
-
parent_timer = Rack::MiniProfiler.current.current_timer
|
85
|
-
page_struct = Rack::MiniProfiler.current.page_struct
|
86
92
|
result = nil
|
93
|
+
parent_timer = Rack::MiniProfiler.current.current_timer
|
87
94
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
95
|
+
if type == :counter
|
96
|
+
start = Time.now
|
97
|
+
begin
|
98
|
+
result = self.send without_profiling, *args, &orig
|
99
|
+
ensure
|
100
|
+
duration_ms = (Time.now - start).to_f * 1000
|
101
|
+
parent_timer.add_custom(name, duration_ms, Rack::MiniProfiler.current.page_struct )
|
102
|
+
end
|
103
|
+
else
|
104
|
+
page_struct = Rack::MiniProfiler.current.page_struct
|
105
|
+
|
106
|
+
Rack::MiniProfiler.current.current_timer = current_timer = parent_timer.add_child(name)
|
107
|
+
begin
|
108
|
+
result = self.send without_profiling, *args, &orig
|
109
|
+
ensure
|
110
|
+
current_timer.record_time
|
111
|
+
Rack::MiniProfiler.current.current_timer = parent_timer
|
112
|
+
end
|
94
113
|
end
|
114
|
+
|
95
115
|
result
|
96
116
|
end
|
97
117
|
klass.send :alias_method, method, with_profiling
|
98
118
|
end
|
99
|
-
|
119
|
+
|
100
120
|
# Add a custom timing. These are displayed similar to SQL/query time in
|
101
121
|
# columns expanding to the right.
|
102
122
|
#
|
@@ -4,7 +4,7 @@ module Rack
|
|
4
4
|
class MiniProfiler
|
5
5
|
|
6
6
|
class RequestTimerStruct < TimerStruct
|
7
|
-
|
7
|
+
|
8
8
|
def self.createRoot(name, page)
|
9
9
|
rt = RequestTimerStruct.new(name, page, nil)
|
10
10
|
rt["IsRoot"]= true
|
@@ -77,7 +77,7 @@ module Rack
|
|
77
77
|
self['SqlTimings'].push(timer)
|
78
78
|
self['HasSqlTimings'] = true
|
79
79
|
self['SqlTimingsDurationMilliseconds'] += elapsed_ms
|
80
|
-
page['DurationMillisecondsInSql'] += elapsed_ms
|
80
|
+
page['DurationMillisecondsInSql'] += elapsed_ms
|
81
81
|
timer
|
82
82
|
end
|
83
83
|
|
@@ -103,13 +103,13 @@ module Rack
|
|
103
103
|
self['DurationMilliseconds'] = milliseconds
|
104
104
|
self['IsTrivial'] = true if milliseconds < self["TrivialDurationThresholdMilliseconds"]
|
105
105
|
self['DurationWithoutChildrenMilliseconds'] = milliseconds - @children_duration
|
106
|
-
|
106
|
+
|
107
107
|
if @parent
|
108
108
|
@parent.children_duration += milliseconds
|
109
109
|
end
|
110
110
|
|
111
|
-
end
|
111
|
+
end
|
112
112
|
end
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
end
|
data/rack-mini-profiler.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rack-mini-profiler"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.30"
|
4
4
|
s.summary = "Profiles loading speed for rack applications."
|
5
5
|
s.authors = ["Sam Saffron", "Robin Ward","Aleks Totic"]
|
6
6
|
s.description = "Profiling toolkit for Rack applications with Rails integration. Client Side profiling, DB profiling and Server profiling."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-mini-profiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-08-
|
13
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|