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 +4 -4
- data/lib/wildsight/rails/railtie.rb +64 -59
- 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: 2d472003c294864dc7ea27909c1cdc6d2616e7a8
|
4
|
+
data.tar.gz: 336115f56d8fd0c705beefa6bf5fbb3c2f76a20c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
6
|
-
|
7
|
-
end
|
4
|
+
def self.instrument
|
5
|
+
return if @instrumented
|
8
6
|
|
9
|
-
|
10
|
-
ActiveSupport.on_load(:action_controller) do
|
7
|
+
@instrumented = true
|
11
8
|
|
12
|
-
|
9
|
+
::Rails::Engine.class_eval do
|
13
10
|
|
14
|
-
|
11
|
+
alias_method :call_without_ws, :call
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
def call(env)
|
14
|
+
context = Wildsight::Agent.default.context
|
15
|
+
context.bind_thread
|
16
|
+
context.rack_instrument_request(env)
|
20
17
|
|
21
|
-
|
18
|
+
response = context.profiler.duration(:middleware) { call_without_ws(env) }
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
return response
|
21
|
+
ensure
|
22
|
+
context.rack_report(env, response)
|
23
|
+
context.release_thread
|
24
|
+
context.unregister
|
25
|
+
end
|
29
26
|
|
30
|
-
|
27
|
+
end
|
31
28
|
|
32
|
-
|
29
|
+
::ActionDispatch::Routing::RouteSet.class_eval do
|
33
30
|
|
34
|
-
|
31
|
+
alias_method :call_without_ws, :call
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
40
|
+
::AbstractController::Base.class_eval do
|
44
41
|
|
45
|
-
|
42
|
+
include Wildsight::Rails::ActionController
|
46
43
|
|
47
|
-
|
48
|
-
|
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
|
-
|
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
|
-
|
53
|
+
def wildsight_context
|
54
|
+
@_wildsight_context ||= Wildsight::Context::Rack.detect_context(request.env)
|
55
|
+
end
|
56
56
|
|
57
|
-
|
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
|
-
|
60
|
-
@_wildsight_context ||= Wildsight::Context::Rack.detect_context(request.env)
|
61
|
-
end
|
69
|
+
::AbstractController::Rendering.class_eval do
|
62
70
|
|
63
|
-
|
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
|
-
|
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
|
-
|
79
|
+
end
|
78
80
|
|
79
|
-
|
81
|
+
end
|
80
82
|
|
81
|
-
|
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
|
data/lib/wildsight/version.rb
CHANGED