wildsight 0.1.20 → 0.1.21
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/lib/wildsight/profiler/profiler.rb +13 -4
- data/lib/wildsight/rack/top_middleware.rb +6 -2
- data/lib/wildsight/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f2c893cb28bf60914cc72261d5092185894366c
|
4
|
+
data.tar.gz: 598a0176686af5ffe7206a1a933c1d74295e11bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c550393fd8fc5d74777a4d655a1b05d4416798781b002388c719cb9d71f4ed8201c6054e574e3c663ac88f5e1cf6d6ef4187846d5e522853ddbc71274d53d92
|
7
|
+
data.tar.gz: 6f741f0b59f14cda66c95464e178e214938ea8135988456ef4c3d9775a1259fcd9495af2f53578558baaf0f163c35e8ca4702f2fd3ba3c502e917562776f0d5e
|
@@ -9,7 +9,8 @@ module Wildsight
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def duration(name, time = nil, options = {}, &block)
|
12
|
-
p = @profile = Profile.new(@profile)
|
12
|
+
p = @profile = Profile.new(name, @profile)
|
13
|
+
@profile.options = options
|
13
14
|
|
14
15
|
if block_given?
|
15
16
|
@profile.profile!(&block)
|
@@ -38,7 +39,10 @@ module Wildsight
|
|
38
39
|
|
39
40
|
class Profile
|
40
41
|
|
41
|
-
|
42
|
+
attr_accessor :options
|
43
|
+
|
44
|
+
def initialize(name, parent)
|
45
|
+
@name = name
|
42
46
|
@parent = parent
|
43
47
|
@subtimes = []
|
44
48
|
@result = nil
|
@@ -61,7 +65,7 @@ module Wildsight
|
|
61
65
|
end
|
62
66
|
|
63
67
|
def close
|
64
|
-
@parent <<
|
68
|
+
@parent << raw if @parent
|
65
69
|
@parent
|
66
70
|
end
|
67
71
|
|
@@ -77,8 +81,13 @@ module Wildsight
|
|
77
81
|
@subtimes << time
|
78
82
|
end
|
79
83
|
|
84
|
+
def subtimes
|
85
|
+
@subtimes.inject(0.0) { |c,x| c + x }
|
86
|
+
end
|
87
|
+
|
80
88
|
def duration
|
81
|
-
return raw
|
89
|
+
return raw if options[:raw]
|
90
|
+
return raw - subtimes
|
82
91
|
end
|
83
92
|
|
84
93
|
def raw
|
@@ -36,7 +36,11 @@ module Wildsight
|
|
36
36
|
|
37
37
|
env[Wildsight::Rack::RACK_ENV_KEY] = context
|
38
38
|
|
39
|
-
response = context.profiler.duration(:
|
39
|
+
response = context.profiler.duration(:request, nil, raw: true) {
|
40
|
+
context.profiler.duration(:middleware) {
|
41
|
+
@app.call(env)
|
42
|
+
}
|
43
|
+
}
|
40
44
|
|
41
45
|
if !context.data[:session] && !env['rack.session'].nil? && env['rack.session'].respond_to?(:id)
|
42
46
|
context.data[:session] ||= {id: env['rack.session'].id}
|
@@ -53,7 +57,7 @@ module Wildsight
|
|
53
57
|
context.event(:action_controller, context.data[:rack])
|
54
58
|
|
55
59
|
context.profiler.data.keys.each do |key|
|
56
|
-
context.metric(key, context.profiler.data[key][:duration])
|
60
|
+
context.metric("rails.#{key}", context.profiler.data[key][:duration])
|
57
61
|
end
|
58
62
|
|
59
63
|
return response
|
data/lib/wildsight/version.rb
CHANGED