errplane 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/errplane/rails.rb +2 -14
- data/lib/errplane/rails/benchmarking.rb +31 -0
- data/lib/errplane/version.rb +1 -1
- data/lib/errplane/worker.rb +10 -6
- metadata +26 -80
data/lib/errplane/rails.rb
CHANGED
@@ -2,12 +2,14 @@ require 'action_controller'
|
|
2
2
|
require 'errplane'
|
3
3
|
require 'errplane/rails/middleware/hijack_rescue_action_everywhere'
|
4
4
|
require 'errplane/rails/air_traffic_controller'
|
5
|
+
require 'errplane/rails/benchmarking'
|
5
6
|
|
6
7
|
module Errplane
|
7
8
|
module Rails
|
8
9
|
def self.initialize
|
9
10
|
ActionController::Base.send(:include, Errplane::Rails::AirTrafficController)
|
10
11
|
ActionController::Base.send(:include, Errplane::Rails::Middleware::HijackRescueActionEverywhere)
|
12
|
+
ActionController::Base.send(:include, Errplane::Rails::Benchmarking)
|
11
13
|
|
12
14
|
::Rails.configuration.middleware.insert_after 'ActionController::Failsafe', Errplane::Rack
|
13
15
|
|
@@ -21,20 +23,6 @@ module Errplane
|
|
21
23
|
config.framework_version = ::Rails.version
|
22
24
|
end
|
23
25
|
|
24
|
-
if defined?(ActiveSupport::Notifications)
|
25
|
-
ActiveSupport::Notifications.subscribe do |name, start, finish, id, payload|
|
26
|
-
if Errplane.configuration.instrumentation_enabled?
|
27
|
-
h = { :name => name,
|
28
|
-
:start => start,
|
29
|
-
:finish => finish,
|
30
|
-
:nid => id,
|
31
|
-
:payload => payload,
|
32
|
-
:source => "active_support"}
|
33
|
-
Errplane.queue.push_or_discard(h)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
26
|
if defined?(PhusionPassenger)
|
39
27
|
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
40
28
|
Errplane::Worker.spawn_threads() if forked
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
|
3
|
+
module Errplane
|
4
|
+
module Rails
|
5
|
+
module Benchmarking
|
6
|
+
def self.included(base)
|
7
|
+
base.send(:alias_method_chain, :perform_action, :instrumentation)
|
8
|
+
base.send(:alias_method_chain, :view_runtime, :instrumentation)
|
9
|
+
base.send(:alias_method_chain, :active_record_runtime, :instrumentation)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def perform_action_with_instrumentation
|
14
|
+
ms = Benchmark.ms { perform_action_without_instrumentation }
|
15
|
+
Errplane.report "controllers/#{params[:controller]}/#{params[:action]}", :value => ms.ceil
|
16
|
+
end
|
17
|
+
|
18
|
+
def view_runtime_with_instrumentation
|
19
|
+
runtime = view_runtime_without_instrumentation
|
20
|
+
Errplane.report "views", :value => runtime.split.last.to_f.ceil
|
21
|
+
runtime
|
22
|
+
end
|
23
|
+
|
24
|
+
def active_record_runtime_with_instrumentation
|
25
|
+
runtime = active_record_runtime_without_instrumentation
|
26
|
+
Errplane.report "db", :value => runtime.split.last.to_f.ceil
|
27
|
+
runtime
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/errplane/version.rb
CHANGED
data/lib/errplane/worker.rb
CHANGED
@@ -57,24 +57,28 @@ module Errplane
|
|
57
57
|
data = []
|
58
58
|
|
59
59
|
while !Errplane.queue.empty? && data.size < 200
|
60
|
-
log :debug, "Found data in the queue
|
60
|
+
log :debug, "Found data in the queue!"
|
61
61
|
n = Errplane.queue.pop
|
62
|
+
log :debug, n.inspect
|
62
63
|
|
63
64
|
begin
|
64
65
|
case n[:source]
|
65
66
|
when "active_support"
|
66
67
|
case n[:name].to_s
|
67
68
|
when "process_action.action_controller"
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
timestamp = n[:finish].utc.to_i
|
70
|
+
controller_runtime = ((n[:finish] - n[:start])*1000).ceil
|
71
|
+
view_runtime = (n[:payload][:view_runtime] || 0).ceil
|
72
|
+
db_runtime = (n[:payload][:db_runtime] || 0).ceil
|
73
|
+
|
74
|
+
data << "controllers/#{n[:payload][:controller]}/#{n[:payload][:action]} #{controller_runtime} #{timestamp}"
|
75
|
+
data << "views #{view_runtime} #{timestamp}"
|
76
|
+
data << "db #{db_runtime} #{timestamp}"
|
72
77
|
end
|
73
78
|
when "exception"
|
74
79
|
Errplane.transmitter.deliver n[:data], n[:url]
|
75
80
|
when "custom"
|
76
81
|
line = "#{n[:name]} #{n[:value] || 1} #{n[:timestamp]}"
|
77
|
-
# adding the message in this way to ensure that the space between the timestamp and the base64 encoded part goes in.
|
78
82
|
line = "#{line} #{Base64.encode64(n[:message]).strip}" if n[:message]
|
79
83
|
data << line
|
80
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: errplane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70210053349860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *70210053349860
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: activesupport
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70210053349300 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: 2.3.14
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.3.14
|
35
|
+
version_requirements: *70210053349300
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: actionpack
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70210053348660 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: 2.3.14
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 2.3.14
|
46
|
+
version_requirements: *70210053348660
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: bundler
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70210053348120 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ! '>='
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: 1.0.0
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 1.0.0
|
57
|
+
version_requirements: *70210053348120
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: fakeweb
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70210053347360 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *70210053347360
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: guard
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70210053346240 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: '0'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
79
|
+
version_requirements: *70210053346240
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: guard-rspec
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &70210053344980 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ! '>='
|
@@ -117,15 +87,10 @@ dependencies:
|
|
117
87
|
version: '0'
|
118
88
|
type: :development
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
90
|
+
version_requirements: *70210053344980
|
126
91
|
- !ruby/object:Gem::Dependency
|
127
92
|
name: rake
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirement: &70210053344140 !ruby/object:Gem::Requirement
|
129
94
|
none: false
|
130
95
|
requirements:
|
131
96
|
- - ! '>='
|
@@ -133,15 +98,10 @@ dependencies:
|
|
133
98
|
version: '0'
|
134
99
|
type: :development
|
135
100
|
prerelease: false
|
136
|
-
version_requirements:
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
101
|
+
version_requirements: *70210053344140
|
142
102
|
- !ruby/object:Gem::Dependency
|
143
103
|
name: rdoc
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirement: &70210053342860 !ruby/object:Gem::Requirement
|
145
105
|
none: false
|
146
106
|
requirements:
|
147
107
|
- - ! '>='
|
@@ -149,15 +109,10 @@ dependencies:
|
|
149
109
|
version: '0'
|
150
110
|
type: :development
|
151
111
|
prerelease: false
|
152
|
-
version_requirements:
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
112
|
+
version_requirements: *70210053342860
|
158
113
|
- !ruby/object:Gem::Dependency
|
159
114
|
name: rspec
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirement: &70210053341860 !ruby/object:Gem::Requirement
|
161
116
|
none: false
|
162
117
|
requirements:
|
163
118
|
- - ! '>='
|
@@ -165,15 +120,10 @@ dependencies:
|
|
165
120
|
version: '0'
|
166
121
|
type: :development
|
167
122
|
prerelease: false
|
168
|
-
version_requirements:
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
123
|
+
version_requirements: *70210053341860
|
174
124
|
- !ruby/object:Gem::Dependency
|
175
125
|
name: tzinfo
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirement: &70210053340520 !ruby/object:Gem::Requirement
|
177
127
|
none: false
|
178
128
|
requirements:
|
179
129
|
- - ! '>='
|
@@ -181,12 +131,7 @@ dependencies:
|
|
181
131
|
version: '0'
|
182
132
|
type: :development
|
183
133
|
prerelease: false
|
184
|
-
version_requirements:
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
134
|
+
version_requirements: *70210053340520
|
190
135
|
description: This gem provides exception reporting with Errplane for Rails 3.x applications.
|
191
136
|
email:
|
192
137
|
- todd@errplane.com
|
@@ -218,6 +163,7 @@ files:
|
|
218
163
|
- lib/errplane/rack.rb
|
219
164
|
- lib/errplane/rails.rb
|
220
165
|
- lib/errplane/rails/air_traffic_controller.rb
|
166
|
+
- lib/errplane/rails/benchmarking.rb
|
221
167
|
- lib/errplane/rails/instrumentation.rb
|
222
168
|
- lib/errplane/rails/middleware/hijack_render_exception.rb
|
223
169
|
- lib/errplane/rails/middleware/hijack_rescue_action_everywhere.rb
|
@@ -275,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
221
|
version: '0'
|
276
222
|
requirements: []
|
277
223
|
rubyforge_project: errplane
|
278
|
-
rubygems_version: 1.8.
|
224
|
+
rubygems_version: 1.8.15
|
279
225
|
signing_key:
|
280
226
|
specification_version: 3
|
281
227
|
summary: Rails exception reporting for Errplane.
|