wildsight 0.1.12 → 0.1.13

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: d0b043b6bdf567a187eaf195729978ab7b187fe1
4
- data.tar.gz: 79421c3cba0177185caf0f8235512a7a93c0c162
3
+ metadata.gz: 2d472003c294864dc7ea27909c1cdc6d2616e7a8
4
+ data.tar.gz: 336115f56d8fd0c705beefa6bf5fbb3c2f76a20c
5
5
  SHA512:
6
- metadata.gz: ffcaec0911490b358e86cd2a251fc71b25d7c9be9b2bc9f0ff9ea10aa34dea60e83b308721d374f4c27c892828ef16658e74be31ce305a866cda196ba3e4b5a8
7
- data.tar.gz: 6d9e9cb8c1f5c19cc59912c35b156105a5fab5356ecb49ab8676276ccd689bf12da971fdb1e4552fe01a4785b0cd00b3ae61dbb55f37e5c7a2662e145c84e380
6
+ metadata.gz: dc77bb0ac9e749011506c9d28b1945102559e18f6f1f14b48504cd7c56b83624f5eafbe795f564caee21dc6ba78f1a2499f958be3f60e0bdb1a125c1136f53ce
7
+ data.tar.gz: ffa1728fb8d9c49a7b4303bbed033b54ce8d442d8a5ddc1872774ae0eb65ed8000ff167f80ec0613b970eb1327f47aaf8ed4cb30903b4e4528237abd3ea2420e
@@ -1,89 +1,94 @@
1
1
  module Wildsight
2
2
  module Rails
3
- class Railtie < ::Rails::Railtie
4
3
 
5
- initializer('wildsight.rails.logger') do |app|
6
- ::Rails.logger.extend(ActiveSupport::Logger.broadcast(Wildsight::Context::Logger.new))
7
- end
4
+ def self.instrument
5
+ return if @instrumented
8
6
 
9
- initializer('wildsight.action_controller.extensions') do |app|
10
- ActiveSupport.on_load(:action_controller) do
7
+ @instrumented = true
11
8
 
12
- ::Rails::Engine.class_eval do
9
+ ::Rails::Engine.class_eval do
13
10
 
14
- alias_method :call_without_ws, :call
11
+ alias_method :call_without_ws, :call
15
12
 
16
- def call(env)
17
- context = Wildsight::Agent.default.context
18
- context.bind_thread
19
- context.rack_instrument_request(env)
13
+ def call(env)
14
+ context = Wildsight::Agent.default.context
15
+ context.bind_thread
16
+ context.rack_instrument_request(env)
20
17
 
21
- response = context.profiler.duration(:middleware) { call_without_ws(env) }
18
+ response = context.profiler.duration(:middleware) { call_without_ws(env) }
22
19
 
23
- return response
24
- ensure
25
- context.rack_report(env, response)
26
- context.release_thread
27
- context.unregister
28
- end
20
+ return response
21
+ ensure
22
+ context.rack_report(env, response)
23
+ context.release_thread
24
+ context.unregister
25
+ end
29
26
 
30
- end
27
+ end
31
28
 
32
- ::ActionDispatch::Routing::RouteSet.class_eval do
29
+ ::ActionDispatch::Routing::RouteSet.class_eval do
33
30
 
34
- alias_method :call_without_ws, :call
31
+ alias_method :call_without_ws, :call
35
32
 
36
- def call(env)
37
- context = Wildsight::Context::Rack.detect_context(env)
38
- result = context.profiler.duration(:routing) { call_without_ws(env) }
39
- return result
40
- end
41
- end
33
+ def call(env)
34
+ context = Wildsight::Context::Rack.detect_context(env)
35
+ result = context.profiler.duration(:routing) { call_without_ws(env) }
36
+ return result
37
+ end
38
+ end
42
39
 
43
- ::AbstractController::Base.class_eval do
40
+ ::AbstractController::Base.class_eval do
44
41
 
45
- alias_method :process_without_ws, :process
42
+ include Wildsight::Rails::ActionController
46
43
 
47
- def process(*args)
48
- context = Wildsight::Context::Rack.detect_context(request.env)
49
- result = context.profiler.duration(:rails) { process_without_ws(*args) }
50
- return result
51
- end
44
+ alias_method :process_without_ws, :process
45
+ alias_method :process_action_without_ws, :process_action
52
46
 
53
- end
47
+ def process(*args)
48
+ context = Wildsight::Context::Rack.detect_context(request.env)
49
+ result = context.profiler.duration(:rails) { process_without_ws(*args) }
50
+ return result
51
+ end
54
52
 
55
- self.class_eval do
53
+ def wildsight_context
54
+ @_wildsight_context ||= Wildsight::Context::Rack.detect_context(request.env)
55
+ end
56
56
 
57
- alias_method :process_action_without_ws, :process_action
57
+ def process_action(*args)
58
+ context = Wildsight::Context::Rack.detect_context(request.env)
59
+ context.rails_extract(self)
60
+ result = context.profiler.duration(:action) { process_action_without_ws(*args) }
61
+ return result
62
+ rescue Exception => e
63
+ request.env['rack.exception'] = e
64
+ raise e
65
+ end
66
+
67
+ end
58
68
 
59
- def wildsight_context
60
- @_wildsight_context ||= Wildsight::Context::Rack.detect_context(request.env)
61
- end
69
+ ::AbstractController::Rendering.class_eval do
62
70
 
63
- def process_action(*args)
64
- context = Wildsight::Context::Rack.detect_context(request.env)
65
- context.rails_extract(self)
66
- result = context.profiler.duration(:action) { process_action_without_ws(*args) }
67
- return result
68
- rescue Exception => e
69
- request.env['rack.exception'] = e
70
- raise e
71
- end
72
- end
71
+ alias_method :render_without_ws, :render
73
72
 
74
- include Wildsight::Rails::ActionController
73
+ def render(*args, &block)
74
+ context = Wildsight::Context::Rack.detect_context(request.env)
75
+ result = context.profiler.duration(:render) { render_without_ws(*args, &block) }
76
+ return result
75
77
  end
76
78
 
77
- ::AbstractController::Rendering.class_eval do
79
+ end
78
80
 
79
- alias_method :render_without_ws, :render
81
+ end
80
82
 
81
- def render(*args, &block)
82
- context = Wildsight::Context::Rack.detect_context(request.env)
83
- result = context.profiler.duration(:render) { render_without_ws(*args, &block) }
84
- return result
85
- end
83
+ class Railtie < ::Rails::Railtie
86
84
 
85
+ initializer('wildsight.rails.logger') do |app|
86
+ ::Rails.logger.extend(ActiveSupport::Logger.broadcast(Wildsight::Context::Logger.new))
87
+ end
88
+
89
+ initializer('wildsight.action_controller.extensions') do |app|
90
+ ActiveSupport.on_load(:action_controller) do
91
+ Wildsight::Rails.instrument
87
92
  end
88
93
 
89
94
  end
@@ -1,3 +1,3 @@
1
1
  module Wildsight
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.13'
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.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Jelen