oboe 2.1.4 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +27 -17
- data/lib/oboe/api.rb +1 -0
- data/lib/oboe/api/layerinit.rb +6 -6
- data/lib/oboe/api/profiling.rb +47 -0
- data/lib/oboe/config.rb +32 -0
- data/lib/oboe/frameworks/rails.rb +0 -2
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +34 -2
- data/lib/oboe/frameworks/rails/inst/action_view.rb +29 -165
- data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +54 -0
- data/lib/oboe/frameworks/rails/inst/action_view_30.rb +48 -0
- data/lib/oboe/frameworks/rails/inst/active_record.rb +5 -279
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +92 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +55 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +18 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +57 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +105 -0
- data/lib/oboe/inst/dalli.rb +5 -3
- data/lib/oboe/inst/rack.rb +17 -9
- data/lib/oboe/loading.rb +0 -36
- data/lib/oboe/ruby.rb +0 -1
- data/lib/oboe/version.rb +2 -2
- data/lib/rails/generators/oboe/install_generator.rb +15 -7
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +15 -5
- data/oboe.gemspec +0 -10
- metadata +14 -14
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2013 by Tracelytics, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
|
5
|
+
|
6
|
+
if Rails::VERSION::MAJOR == 2
|
7
|
+
|
8
|
+
Oboe.logger.info "[oboe/loading] Instrumenting actionview" if Oboe::Config[:verbose]
|
9
|
+
|
10
|
+
ActionView::Partials.module_eval do
|
11
|
+
alias :render_partial_without_oboe :render_partial
|
12
|
+
def render_partial(options = {})
|
13
|
+
if options.has_key?(:partial) and options[:partial].is_a?(String)
|
14
|
+
entry_kvs = {}
|
15
|
+
begin
|
16
|
+
name = options[:partial].to_s if options.is_a?(Hash)
|
17
|
+
entry_kvs[:FunctionName] = :render_partial
|
18
|
+
entry_kvs[:Class] = :Partials
|
19
|
+
entry_kvs[:Module] = :ActionView
|
20
|
+
entry_kvs[:File] = __FILE__
|
21
|
+
entry_kvs[:LineNumber] = __LINE__
|
22
|
+
rescue
|
23
|
+
end
|
24
|
+
|
25
|
+
Oboe::API.profile(name, entry_kvs) do
|
26
|
+
render_partial_without_oboe(options)
|
27
|
+
end
|
28
|
+
else
|
29
|
+
render_partial_without_oboe(options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
alias :render_partial_collection_without_oboe :render_partial_collection
|
34
|
+
def render_partial_collection(options = {})
|
35
|
+
entry_kvs = {}
|
36
|
+
begin
|
37
|
+
name = "partial_collection"
|
38
|
+
entry_kvs[:FunctionName] = :render_partial_collection
|
39
|
+
entry_kvs[:Class] = :Partials
|
40
|
+
entry_kvs[:Module] = :ActionView
|
41
|
+
entry_kvs[:File] = __FILE__
|
42
|
+
entry_kvs[:LineNumber] = __LINE__
|
43
|
+
rescue
|
44
|
+
end
|
45
|
+
|
46
|
+
Oboe::API.profile(name, entry_kvs) do
|
47
|
+
render_partial_collection_without_oboe(options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# vim:set expandtab:tabstop=2
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright (c) 2012 by Tracelytics, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
|
5
|
+
|
6
|
+
if Rails::VERSION::MAJOR == 3 and Rails::VERSION::MINOR == 0
|
7
|
+
|
8
|
+
ActionView::Partials::PartialRenderer.class_eval do
|
9
|
+
alias :render_partial_without_oboe :render_partial
|
10
|
+
def render_partial(object = @object)
|
11
|
+
entry_kvs = {}
|
12
|
+
begin
|
13
|
+
name = @options[:partial].to_s if @options.is_a?(Hash)
|
14
|
+
entry_kvs[:FunctionName] = :render_partial
|
15
|
+
entry_kvs[:Class] = :PartialRenderer
|
16
|
+
entry_kvs[:Module] = 'ActionView::Partials'
|
17
|
+
entry_kvs[:File] = __FILE__
|
18
|
+
entry_kvs[:LineNumber] = __LINE__
|
19
|
+
rescue
|
20
|
+
end
|
21
|
+
|
22
|
+
Oboe::API.profile(name, entry_kvs) do
|
23
|
+
render_partial_without_oboe(object)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
alias :render_collection_without_oboe :render_collection
|
28
|
+
def render_collection
|
29
|
+
entry_kvs = {}
|
30
|
+
begin
|
31
|
+
name = @path
|
32
|
+
entry_kvs[:FunctionName] = :render_collection
|
33
|
+
entry_kvs[:Class] = :PartialRenderer
|
34
|
+
entry_kvs[:Module] = 'ActionView::Partials'
|
35
|
+
entry_kvs[:File] = __FILE__
|
36
|
+
entry_kvs[:LineNumber] = __LINE__
|
37
|
+
rescue
|
38
|
+
end
|
39
|
+
|
40
|
+
Oboe::API.profile(name, entry_kvs) do
|
41
|
+
render_collection_without_oboe
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# vim:set expandtab:tabstop=2
|
@@ -1,285 +1,11 @@
|
|
1
1
|
# Copyright (c) 2012 by Tracelytics, Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
opts = {}
|
10
|
-
|
11
|
-
begin
|
12
|
-
opts[:Query] = sql.to_s
|
13
|
-
opts[:Name] = name.to_s if name
|
14
|
-
opts[:Backtrace] = Oboe::API.backtrace
|
15
|
-
|
16
|
-
if ::Rails::VERSION::MAJOR == 2
|
17
|
-
config = ::Rails.configuration.database_configuration[::Rails.env]
|
18
|
-
else
|
19
|
-
config = ::Rails.application.config.database_configuration[::Rails.env]
|
20
|
-
end
|
21
|
-
|
22
|
-
opts[:Database] = config["database"] if config.has_key?("database")
|
23
|
-
opts[:RemoteHost] = config["host"] if config.has_key?("host")
|
24
|
-
opts[:Flavor] = config["adapter"] if config.has_key?("adapter")
|
25
|
-
rescue Exception => e
|
26
|
-
end
|
27
|
-
|
28
|
-
return opts || {}
|
29
|
-
end
|
30
|
-
|
31
|
-
# We don't want to trace framework caches. Only instrument SQL that
|
32
|
-
# directly hits the database.
|
33
|
-
def ignore_payload?(name)
|
34
|
-
%w(SCHEMA EXPLAIN CACHE).include? name.to_s or (name and name.to_sym == :skip_logging)
|
35
|
-
end
|
36
|
-
|
37
|
-
def cfg
|
38
|
-
@config
|
39
|
-
end
|
40
|
-
|
41
|
-
def execute_with_oboe(sql, name = nil)
|
42
|
-
if Oboe.tracing? and !ignore_payload?(name)
|
43
|
-
|
44
|
-
opts = extract_trace_details(sql, name)
|
45
|
-
Oboe::API.trace('activerecord', opts || {}) do
|
46
|
-
execute_without_oboe(sql, name)
|
47
|
-
end
|
48
|
-
else
|
49
|
-
execute_without_oboe(sql, name)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def exec_query_with_oboe(sql, name = nil, binds = [])
|
54
|
-
if Oboe.tracing? and !ignore_payload?(name)
|
55
|
-
|
56
|
-
opts = extract_trace_details(sql, name)
|
57
|
-
Oboe::API.trace('activerecord', opts || {}) do
|
58
|
-
exec_query_without_oboe(sql, name, binds)
|
59
|
-
end
|
60
|
-
else
|
61
|
-
exec_query_without_oboe(sql, name, binds)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def exec_delete_with_oboe(sql, name = nil, binds = [])
|
66
|
-
if Oboe.tracing? and !ignore_payload?(name)
|
67
|
-
|
68
|
-
opts = extract_trace_details(sql, name)
|
69
|
-
Oboe::API.trace('activerecord', opts || {}) do
|
70
|
-
exec_delete_without_oboe(sql, name, binds)
|
71
|
-
end
|
72
|
-
else
|
73
|
-
exec_delete_without_oboe(sql, name, binds)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def exec_insert_with_oboe(sql, name = nil, binds = [])
|
78
|
-
if Oboe.tracing? and !ignore_payload?(name)
|
79
|
-
|
80
|
-
opts = extract_trace_details(sql, name)
|
81
|
-
Oboe::API.trace('activerecord', opts || {}) do
|
82
|
-
exec_insert_without_oboe(sql, name, binds)
|
83
|
-
end
|
84
|
-
else
|
85
|
-
exec_insert_without_oboe(sql, name, binds)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def begin_db_transaction_with_oboe()
|
90
|
-
if Oboe.tracing?
|
91
|
-
opts = {}
|
92
|
-
|
93
|
-
opts[:Query] = "BEGIN"
|
94
|
-
Oboe::API.trace('activerecord', opts || {}) do
|
95
|
-
begin_db_transaction_without_oboe()
|
96
|
-
end
|
97
|
-
else
|
98
|
-
begin_db_transaction_without_oboe()
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end # Utils
|
102
|
-
|
103
|
-
module PostgreSQLAdapter
|
104
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
105
|
-
|
106
|
-
def self.included(cls)
|
107
|
-
cls.class_eval do
|
108
|
-
if ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::method_defined? :exec_query
|
109
|
-
alias exec_query_without_oboe exec_query
|
110
|
-
alias exec_query exec_query_with_oboe
|
111
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
112
|
-
end
|
113
|
-
|
114
|
-
if ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::method_defined? :exec_delete
|
115
|
-
alias exec_delete_without_oboe exec_delete
|
116
|
-
alias exec_delete exec_delete_with_oboe
|
117
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end # PostgreSQLAdapter
|
122
|
-
|
123
|
-
module LegacyPostgreSQLAdapter
|
124
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
125
|
-
|
126
|
-
def self.included(cls)
|
127
|
-
cls.class_eval do
|
128
|
-
if ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::method_defined? :execute
|
129
|
-
alias execute_without_oboe execute
|
130
|
-
alias execute execute_with_oboe
|
131
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end # LegacyPostgreSQLAdapter
|
136
|
-
|
137
|
-
module AbstractMysqlAdapter
|
138
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
139
|
-
|
140
|
-
def self.included(cls)
|
141
|
-
cls.class_eval do
|
142
|
-
if ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::method_defined? :execute
|
143
|
-
alias execute_without_oboe execute
|
144
|
-
alias execute execute_with_oboe
|
145
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end # AbstractMysqlAdapter
|
150
|
-
|
151
|
-
module MysqlAdapter
|
152
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
153
|
-
|
154
|
-
def self.included(cls)
|
155
|
-
cls.class_eval do
|
156
|
-
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_query
|
157
|
-
alias exec_query_without_oboe exec_query
|
158
|
-
alias exec_query exec_query_with_oboe
|
159
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end # MysqlAdapter
|
164
|
-
|
165
|
-
module LegacyMysqlAdapter
|
166
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
167
|
-
|
168
|
-
def self.included(cls)
|
169
|
-
cls.class_eval do
|
170
|
-
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :execute
|
171
|
-
alias execute_without_oboe execute
|
172
|
-
alias execute execute_with_oboe
|
173
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
174
|
-
end
|
175
|
-
|
176
|
-
if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR == 1
|
177
|
-
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :begin_db_transaction
|
178
|
-
alias begin_db_transaction_without_oboe begin_db_transaction
|
179
|
-
alias begin_db_transaction begin_db_transaction_with_oboe
|
180
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 0
|
185
|
-
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_query
|
186
|
-
alias exec_query_without_oboe exec_query
|
187
|
-
alias exec_query exec_query_with_oboe
|
188
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
189
|
-
end
|
190
|
-
|
191
|
-
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_delete
|
192
|
-
alias exec_delete_without_oboe exec_delete
|
193
|
-
alias exec_delete exec_delete_with_oboe
|
194
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end # LegacyMysqlAdapter
|
200
|
-
|
201
|
-
module Mysql2Adapter
|
202
|
-
include Oboe::Inst::ConnectionAdapters::Utils
|
203
|
-
|
204
|
-
def self.included(cls)
|
205
|
-
cls.class_eval do
|
206
|
-
if ::Rails::VERSION::MAJOR == 2 or (::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR == 0)
|
207
|
-
if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :execute
|
208
|
-
alias execute_without_oboe execute
|
209
|
-
alias execute execute_with_oboe
|
210
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
211
|
-
end
|
212
|
-
else
|
213
|
-
if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_insert
|
214
|
-
alias exec_insert_without_oboe exec_insert
|
215
|
-
alias exec_insert exec_insert_with_oboe
|
216
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
217
|
-
end
|
218
|
-
|
219
|
-
# In Rails 3.1, exec_query was defined as a private method
|
220
|
-
if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_query or
|
221
|
-
ActiveRecord::ConnectionAdapters::Mysql2Adapter::private_method_defined? :exec_query
|
222
|
-
alias exec_query_without_oboe exec_query
|
223
|
-
alias exec_query exec_query_with_oboe
|
224
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
225
|
-
end
|
226
|
-
|
227
|
-
if ActiveRecord::ConnectionAdapters::Mysql2Adapter::method_defined? :exec_delete
|
228
|
-
alias exec_delete_without_oboe exec_delete
|
229
|
-
alias exec_delete exec_delete_with_oboe
|
230
|
-
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end # Mysql2Adapter
|
236
|
-
|
237
|
-
module FlavorInitializers
|
238
|
-
def self.mysql
|
239
|
-
Oboe.logger.info "[oboe/loading] Instrumenting activerecord mysqladapter" if Oboe::Config[:verbose]
|
240
|
-
if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 1
|
241
|
-
::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.module_eval do
|
242
|
-
include Oboe::Inst::ConnectionAdapters::AbstractMysqlAdapter
|
243
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter)
|
244
|
-
|
245
|
-
::ActiveRecord::ConnectionAdapters::MysqlAdapter.module_eval do
|
246
|
-
include Oboe::Inst::ConnectionAdapters::MysqlAdapter
|
247
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
248
|
-
else
|
249
|
-
::ActiveRecord::ConnectionAdapters::MysqlAdapter.module_eval do
|
250
|
-
include Oboe::Inst::ConnectionAdapters::LegacyMysqlAdapter
|
251
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
def self.mysql2
|
256
|
-
Oboe.logger.info "[oboe/loading] Instrumenting activerecord mysql2adapter" if Oboe::Config[:verbose]
|
257
|
-
::ActiveRecord::ConnectionAdapters::Mysql2Adapter.module_eval do
|
258
|
-
include Oboe::Inst::ConnectionAdapters::Mysql2Adapter
|
259
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
260
|
-
end
|
261
|
-
|
262
|
-
def self.postgresql
|
263
|
-
Oboe.logger.info "[oboe/loading] Instrumenting activerecord postgresqladapter" if Oboe::Config[:verbose]
|
264
|
-
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.module_eval do
|
265
|
-
if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 0
|
266
|
-
include Oboe::Inst::ConnectionAdapters::PostgreSQLAdapter
|
267
|
-
else
|
268
|
-
include Oboe::Inst::ConnectionAdapters::LegacyPostgreSQLAdapter
|
269
|
-
end
|
270
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
271
|
-
end
|
272
|
-
|
273
|
-
def self.oracle
|
274
|
-
Oboe.logger.info "[oboe/loading] Instrumenting activerecord oracleenhancedadapter" if Oboe::Config[:verbose]
|
275
|
-
::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.module_eval do
|
276
|
-
include Oboe::Inst::ConnectionAdapters
|
277
|
-
end if defined?(::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
4
|
+
require 'oboe/frameworks/rails/inst/connection_adapters/utils'
|
5
|
+
require 'oboe/frameworks/rails/inst/connection_adapters/mysql'
|
6
|
+
require 'oboe/frameworks/rails/inst/connection_adapters/mysql2'
|
7
|
+
require 'oboe/frameworks/rails/inst/connection_adapters/postgresql'
|
8
|
+
require 'oboe/frameworks/rails/inst/connection_adapters/oracle'
|
283
9
|
|
284
10
|
if Oboe::Config[:active_record][:enabled]
|
285
11
|
begin
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright (c) 2013 by AppNeta
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
module Inst
|
6
|
+
module ConnectionAdapters
|
7
|
+
|
8
|
+
module AbstractMysqlAdapter
|
9
|
+
include Oboe::Inst::ConnectionAdapters::Utils
|
10
|
+
|
11
|
+
def self.included(cls)
|
12
|
+
cls.class_eval do
|
13
|
+
if ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::method_defined? :execute
|
14
|
+
alias execute_without_oboe execute
|
15
|
+
alias execute execute_with_oboe
|
16
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end # AbstractMysqlAdapter
|
21
|
+
|
22
|
+
module MysqlAdapter
|
23
|
+
include Oboe::Inst::ConnectionAdapters::Utils
|
24
|
+
|
25
|
+
def self.included(cls)
|
26
|
+
cls.class_eval do
|
27
|
+
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_query
|
28
|
+
alias exec_query_without_oboe exec_query
|
29
|
+
alias exec_query exec_query_with_oboe
|
30
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end # MysqlAdapter
|
35
|
+
|
36
|
+
module LegacyMysqlAdapter
|
37
|
+
include Oboe::Inst::ConnectionAdapters::Utils
|
38
|
+
|
39
|
+
def self.included(cls)
|
40
|
+
cls.class_eval do
|
41
|
+
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :execute
|
42
|
+
alias execute_without_oboe execute
|
43
|
+
alias execute execute_with_oboe
|
44
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
45
|
+
end
|
46
|
+
|
47
|
+
if ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR == 1
|
48
|
+
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :begin_db_transaction
|
49
|
+
alias begin_db_transaction_without_oboe begin_db_transaction
|
50
|
+
alias begin_db_transaction begin_db_transaction_with_oboe
|
51
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if (::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 0) or ::Rails::VERSION::MAJOR == 4
|
56
|
+
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_query
|
57
|
+
alias exec_query_without_oboe exec_query
|
58
|
+
alias exec_query exec_query_with_oboe
|
59
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
60
|
+
end
|
61
|
+
|
62
|
+
if ActiveRecord::ConnectionAdapters::MysqlAdapter::method_defined? :exec_delete
|
63
|
+
alias exec_delete_without_oboe exec_delete
|
64
|
+
alias exec_delete exec_delete_with_oboe
|
65
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument activerecord layer. Partial traces may occur."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end # LegacyMysqlAdapter
|
71
|
+
|
72
|
+
module FlavorInitializers
|
73
|
+
def self.mysql
|
74
|
+
Oboe.logger.info "[oboe/loading] Instrumenting activerecord mysqladapter" if Oboe::Config[:verbose]
|
75
|
+
if (::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR > 1) or ::Rails::VERSION::MAJOR == 4
|
76
|
+
::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.module_eval do
|
77
|
+
include Oboe::Inst::ConnectionAdapters::AbstractMysqlAdapter
|
78
|
+
end if defined?(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter)
|
79
|
+
|
80
|
+
::ActiveRecord::ConnectionAdapters::MysqlAdapter.module_eval do
|
81
|
+
include Oboe::Inst::ConnectionAdapters::MysqlAdapter
|
82
|
+
end if defined?(::ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
83
|
+
else
|
84
|
+
::ActiveRecord::ConnectionAdapters::MysqlAdapter.module_eval do
|
85
|
+
include Oboe::Inst::ConnectionAdapters::LegacyMysqlAdapter
|
86
|
+
end if defined?(::ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|