wildsight 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ee42269fa992f53798cec753fcca9badb6fad51
4
- data.tar.gz: 7f13c14c90891d7f58bb557e7a8187b8a23810a6
3
+ metadata.gz: 7f2c893cb28bf60914cc72261d5092185894366c
4
+ data.tar.gz: 598a0176686af5ffe7206a1a933c1d74295e11bb
5
5
  SHA512:
6
- metadata.gz: 295b99bd465d01440b07add3deea6281707366171589b867e365fc0b30e288e0e8105a17c27700c669ba94ce6d33f47654abe203007d8284c29295af34e14297
7
- data.tar.gz: 3a1563a2cea1d09fae697c808c1cba0c5e1ae11aa5d72b650793c7edecae346d0a4582f1dae70ffa06a06c141146379fe34f1a0817e4a258d7a6ac5061b170fb
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
- def initialize(parent)
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 << duration if @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 - @subtimes.inject(0.0) { |c,x| c + x }
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(:middleware) { @app.call(env) }
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
@@ -1,3 +1,3 @@
1
1
  module Wildsight
2
- VERSION = '0.1.20'
2
+ VERSION = '0.1.21'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wildsight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Jelen