oboe 2.7.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +51 -0
- data/Appraisals +10 -0
- data/CHANGELOG.md +223 -0
- data/Gemfile +49 -0
- data/LICENSE +199 -0
- data/README.md +380 -0
- data/Rakefile +106 -0
- data/ext/oboe_metal/extconf.rb +61 -0
- data/ext/oboe_metal/noop/noop.c +7 -0
- data/ext/oboe_metal/src/bson/bson.h +221 -0
- data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
- data/ext/oboe_metal/src/oboe.h +275 -0
- data/ext/oboe_metal/src/oboe.hpp +352 -0
- data/ext/oboe_metal/src/oboe_wrap.cxx +3886 -0
- data/ext/oboe_metal/tests/test.rb +11 -0
- data/gemfiles/mongo.gemfile +33 -0
- data/gemfiles/moped.gemfile +33 -0
- data/get_version.rb +5 -0
- data/init.rb +4 -0
- data/lib/base.rb +99 -0
- data/lib/joboe_metal.rb +185 -0
- data/lib/method_profiling.rb +70 -0
- data/lib/oboe.rb +50 -0
- data/lib/oboe/api.rb +14 -0
- data/lib/oboe/api/layerinit.rb +99 -0
- data/lib/oboe/api/logging.rb +129 -0
- data/lib/oboe/api/memcache.rb +29 -0
- data/lib/oboe/api/profiling.rb +50 -0
- data/lib/oboe/api/tracing.rb +134 -0
- data/lib/oboe/api/util.rb +117 -0
- data/lib/oboe/config.rb +140 -0
- data/lib/oboe/frameworks/grape.rb +74 -0
- data/lib/oboe/frameworks/padrino.rb +66 -0
- data/lib/oboe/frameworks/padrino/templates.rb +59 -0
- data/lib/oboe/frameworks/rails.rb +139 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_ajax_header.js.erb +5 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_footer.js.erb +1 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_header.js.erb +3 -0
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +123 -0
- data/lib/oboe/frameworks/rails/inst/action_view.rb +56 -0
- 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 +24 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +28 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +18 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +30 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +118 -0
- data/lib/oboe/frameworks/sinatra.rb +96 -0
- data/lib/oboe/frameworks/sinatra/templates.rb +56 -0
- data/lib/oboe/inst/cassandra.rb +281 -0
- data/lib/oboe/inst/dalli.rb +75 -0
- data/lib/oboe/inst/http.rb +72 -0
- data/lib/oboe/inst/memcache.rb +105 -0
- data/lib/oboe/inst/memcached.rb +96 -0
- data/lib/oboe/inst/mongo.rb +240 -0
- data/lib/oboe/inst/moped.rb +474 -0
- data/lib/oboe/inst/rack.rb +81 -0
- data/lib/oboe/inst/redis.rb +273 -0
- data/lib/oboe/inst/resque.rb +193 -0
- data/lib/oboe/instrumentation.rb +18 -0
- data/lib/oboe/loading.rb +98 -0
- data/lib/oboe/logger.rb +41 -0
- data/lib/oboe/ruby.rb +11 -0
- data/lib/oboe/util.rb +129 -0
- data/lib/oboe/version.rb +13 -0
- data/lib/oboe/xtrace.rb +52 -0
- data/lib/oboe_metal.rb +140 -0
- data/lib/rails/generators/oboe/install_generator.rb +76 -0
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +94 -0
- data/oboe.gemspec +29 -0
- data/release.sh +65 -0
- data/test/frameworks/apps/grape_simple.rb +10 -0
- data/test/frameworks/apps/padrino_simple.rb +41 -0
- data/test/frameworks/apps/sinatra_simple.rb +20 -0
- data/test/frameworks/grape_test.rb +27 -0
- data/test/frameworks/padrino_test.rb +25 -0
- data/test/frameworks/sinatra_test.rb +25 -0
- data/test/instrumentation/cassandra_test.rb +381 -0
- data/test/instrumentation/dalli_test.rb +164 -0
- data/test/instrumentation/http_test.rb +97 -0
- data/test/instrumentation/memcache_test.rb +251 -0
- data/test/instrumentation/memcached_test.rb +226 -0
- data/test/instrumentation/mongo_test.rb +462 -0
- data/test/instrumentation/moped_test.rb +473 -0
- data/test/instrumentation/rack_test.rb +73 -0
- data/test/instrumentation/redis_hashes_test.rb +265 -0
- data/test/instrumentation/redis_keys_test.rb +318 -0
- data/test/instrumentation/redis_lists_test.rb +310 -0
- data/test/instrumentation/redis_misc_test.rb +160 -0
- data/test/instrumentation/redis_sets_test.rb +293 -0
- data/test/instrumentation/redis_sortedsets_test.rb +325 -0
- data/test/instrumentation/redis_strings_test.rb +333 -0
- data/test/instrumentation/resque_test.rb +62 -0
- data/test/minitest_helper.rb +148 -0
- data/test/profiling/method_test.rb +198 -0
- data/test/support/config_test.rb +39 -0
- data/test/support/liboboe_settings_test.rb +46 -0
- data/test/support/xtrace_test.rb +35 -0
- metadata +200 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
# Copyright (c) 2013 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
module Rails
|
6
|
+
module Helpers
|
7
|
+
extend ActiveSupport::Concern if defined?(::Rails) and ::Rails::VERSION::MAJOR > 2
|
8
|
+
|
9
|
+
@@rum_xhr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_ajax_header.js.erb')
|
10
|
+
@@rum_hdr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_header.js.erb')
|
11
|
+
@@rum_ftr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_footer.js.erb')
|
12
|
+
|
13
|
+
def oboe_rum_header
|
14
|
+
begin
|
15
|
+
return unless Oboe::Config.rum_id
|
16
|
+
if Oboe.tracing?
|
17
|
+
if request.xhr?
|
18
|
+
return raw(ERB.new(@@rum_xhr_tmpl).result)
|
19
|
+
else
|
20
|
+
return raw(ERB.new(@@rum_hdr_tmpl).result)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
rescue StandardError => e
|
24
|
+
Oboe.logger.warn "oboe_rum_header: #{e.message}."
|
25
|
+
return ""
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def oboe_rum_footer
|
30
|
+
begin
|
31
|
+
return unless Oboe::Config.rum_id
|
32
|
+
if Oboe.tracing?
|
33
|
+
# Even though the footer template is named xxxx.erb, there are no ERB tags in it so we'll
|
34
|
+
# skip that step for now
|
35
|
+
return raw(@@rum_ftr_tmpl)
|
36
|
+
end
|
37
|
+
rescue StandardError => e
|
38
|
+
Oboe.logger.warn "oboe_rum_footer: #{e.message}."
|
39
|
+
return ""
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end # Helpers
|
43
|
+
|
44
|
+
def self.load_initializer
|
45
|
+
# Force load the TraceView Rails initializer if there is one
|
46
|
+
# Prefer oboe.rb but give priority to the legacy tracelytics.rb if it exists
|
47
|
+
if ::Rails::VERSION::MAJOR > 2
|
48
|
+
rails_root = "#{::Rails.root.to_s}"
|
49
|
+
else
|
50
|
+
rails_root = "#{RAILS_ROOT}"
|
51
|
+
end
|
52
|
+
|
53
|
+
if File.exists?("#{rails_root}/config/initializers/tracelytics.rb")
|
54
|
+
tr_initializer = "#{rails_root}/config/initializers/tracelytics.rb"
|
55
|
+
else
|
56
|
+
tr_initializer = "#{rails_root}/config/initializers/oboe.rb"
|
57
|
+
end
|
58
|
+
require tr_initializer if File.exists?(tr_initializer)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.load_instrumentation
|
62
|
+
# Load the Rails specific instrumentation
|
63
|
+
pattern = File.join(File.dirname(__FILE__), 'rails/inst', '*.rb')
|
64
|
+
Dir.glob(pattern) do |f|
|
65
|
+
begin
|
66
|
+
require f
|
67
|
+
rescue => e
|
68
|
+
Oboe.logger.error "[oboe/loading] Error loading rails insrumentation file '#{f}' : #{e}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
Oboe.logger.info "TraceView oboe gem #{Oboe::Version::STRING} successfully loaded."
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.include_helpers
|
76
|
+
# TBD: This would make the helpers available to controllers which is occasionally desired.
|
77
|
+
# ActiveSupport.on_load(:action_controller) do
|
78
|
+
# include Oboe::Rails::Helpers
|
79
|
+
# end
|
80
|
+
if ::Rails::VERSION::MAJOR > 2
|
81
|
+
ActiveSupport.on_load(:action_view) do
|
82
|
+
include Oboe::Rails::Helpers
|
83
|
+
end
|
84
|
+
else
|
85
|
+
ActionView::Base.send :include, Oboe::Rails::Helpers
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end # Rails
|
90
|
+
end # Oboe
|
91
|
+
|
92
|
+
if defined?(::Rails)
|
93
|
+
require 'oboe/inst/rack'
|
94
|
+
|
95
|
+
if ::Rails::VERSION::MAJOR > 2
|
96
|
+
module Oboe
|
97
|
+
class Railtie < ::Rails::Railtie
|
98
|
+
|
99
|
+
initializer 'oboe.helpers' do
|
100
|
+
Oboe::Rails.include_helpers
|
101
|
+
end
|
102
|
+
|
103
|
+
initializer 'oboe.rack' do |app|
|
104
|
+
Oboe.logger.info "[oboe/loading] Instrumenting rack" if Oboe::Config[:verbose]
|
105
|
+
app.config.middleware.insert 0, "Oboe::Rack"
|
106
|
+
end
|
107
|
+
|
108
|
+
config.after_initialize do
|
109
|
+
Oboe.logger = ::Rails.logger if ::Rails.logger
|
110
|
+
|
111
|
+
Oboe::Loading.load_access_key
|
112
|
+
Oboe::Inst.load_instrumentation
|
113
|
+
Oboe::Rails.load_instrumentation
|
114
|
+
|
115
|
+
# Report __Init after fork when in Heroku
|
116
|
+
Oboe::API.report_init unless Oboe.heroku?
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
else
|
121
|
+
Oboe.logger = ::Rails.logger if ::Rails.logger
|
122
|
+
|
123
|
+
Oboe::Rails.load_initializer
|
124
|
+
Oboe::Loading.load_access_key
|
125
|
+
|
126
|
+
Rails.configuration.after_initialize do
|
127
|
+
Oboe.logger.info "[oboe/loading] Instrumenting rack" if Oboe::Config[:verbose]
|
128
|
+
Rails.configuration.middleware.insert 0, "Oboe::Rack"
|
129
|
+
|
130
|
+
Oboe::Inst.load_instrumentation
|
131
|
+
Oboe::Rails.load_instrumentation
|
132
|
+
Oboe::Rails.include_helpers
|
133
|
+
|
134
|
+
# Report __Init after fork when in Heroku
|
135
|
+
Oboe::API.report_init unless Oboe.heroku?
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<script type="text/javascript">(function(){var d=this._tly={q:[],mark:function(a,b){d.q.push(["mark",a,b||(new Date).getTime()])},measure:function(a,b,c){d.q.push(["measure",a,b,c||(new Date).getTime()])},done:function(a){d.q.push(["done",a])},cid:"<%= Oboe::Config[:rum_id] %>",xt:"<%= Oboe::Context.toString %>"};d.mark("firstbyte");var f;f=function(){};var g=0;function h(a){return function(b){b[a]||(b[a]=!0,d.measure(["_ajax",b.a,a]))}}var i=h("recv"),j=h("send");
|
2
|
+
function l(){var a=this&&this._tl,b=a.b;4===this.readyState&&i(a);f();for(a=0;a<b.length;a++)b[a].apply(this,arguments)}var m=this.XMLHttpRequest,n=m&&m.prototype;
|
3
|
+
if(n){var o=n.open;n.open=function(a,b,c,e,u){f();this._tl||(this._tl={a:g++,async:c,b:[]},d.measure(["_ajax",this._tl.a,"init",a,b]));return e?o.call(this,a,b,c,e,u):o.call(this,a,b,c)};var p=n.send;n.send=function(a){function b(){try{var a;a:{var b=l;try{if(c.addEventListener){c.addEventListener("readystatechange",b);a=!0;break a}}catch(w){}a=!1}if(!a){var k=c.onreadystatechange;if(k){if(!k.apply)return;f();e.b.push(k)}f();c.onreadystatechange=l}}catch(x){}}var c=this,e=c&&c._tl;f();b();j(e);a=
|
4
|
+
p.call(c,a);!e.async||4===c.readyState?i(e):setTimeout(function(){try{4===c.readyState?i(e):c.onreadystatechange!==l&&b()}catch(a){}},0);return a}}this.onerror=function(a,b,c){d.measure(["_jserror ",a,"|",b,"|",c].join(""))};var q=this.attachEvent,r=this.addEventListener;var s=function(){d.measure("winload");d.done()};q?q("onload",s):r&&r("load",s,!1);var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src=("http:"===document.location.protocol?"http:":"https:")+"//d2gfdmu30u15x7.cloudfront.net/1/tly.js";
|
5
|
+
var v=document.getElementsByTagName("script")[0];v.parentNode.insertBefore(t,v);}());</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
<script type="text/javascript">this._tly&&this._tly.measure("domload");</script>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<script type="text/javascript">(function(){var b=this._tly={q:[],mark:function(a,c){b.q.push(["mark",a,c||(new Date).getTime()])},measure:function(a,c,e){b.q.push(["measure",a,c,e||(new Date).getTime()])},done:function(a){b.q.push(["done",a])},cid:"<%= Oboe::Config[:rum_id] %>",xt:"<%= Oboe::Context.toString %>"};b.mark("firstbyte");this.onerror=function(a,c,e){b.measure(["_jserror ",a,"|",c,"|",e].join(""))};var d=this.attachEvent,f=this.addEventListener;var g=function(){b.measure("winload");b.done()};d?d("onload",g):f&&f("load",g,!1);var h=document.createElement("script");
|
2
|
+
h.type="text/javascript";h.async=!0;h.src=("http:"===document.location.protocol?"http:":"https:")+"//d2gfdmu30u15x7.cloudfront.net/1/tly.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(h,i);}());</script>
|
3
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# Copyright (c) 2013 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
module Inst
|
6
|
+
module Rails3ActionController
|
7
|
+
def self.included(base)
|
8
|
+
base.class_eval do
|
9
|
+
alias_method_chain :process, :oboe
|
10
|
+
alias_method_chain :process_action, :oboe
|
11
|
+
alias_method_chain :render, :oboe
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def process_with_oboe(*args)
|
16
|
+
Oboe::API.trace('rails', {}) do
|
17
|
+
process_without_oboe *args
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def process_action_with_oboe(*args)
|
22
|
+
report_kvs = {
|
23
|
+
:Controller => self.class.name,
|
24
|
+
:Action => self.action_name,
|
25
|
+
}
|
26
|
+
Oboe::API.log(nil, 'info', report_kvs)
|
27
|
+
|
28
|
+
process_action_without_oboe *args
|
29
|
+
rescue Exception => exception
|
30
|
+
report_kvs[:Status] = 500
|
31
|
+
Oboe::API.log(nil, 'info', report_kvs)
|
32
|
+
raise
|
33
|
+
end
|
34
|
+
|
35
|
+
def render_with_oboe(*args)
|
36
|
+
Oboe::API.trace('actionview', {}) do
|
37
|
+
render_without_oboe *args
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Rails4ActionController
|
43
|
+
def self.included(base)
|
44
|
+
base.class_eval do
|
45
|
+
alias_method_chain :process_action, :oboe
|
46
|
+
alias_method_chain :render, :oboe
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def process_action_with_oboe(method_name, *args)
|
51
|
+
return process_action_without_oboe(method_name, *args) if Oboe::Config[:action_blacklist].present? &&
|
52
|
+
Oboe::Config[:action_blacklist][[self.controller_name, self.action_name].join('#')]
|
53
|
+
|
54
|
+
report_kvs = {
|
55
|
+
:Controller => self.class.name,
|
56
|
+
:Action => self.action_name,
|
57
|
+
}
|
58
|
+
Oboe::API.trace('rails', report_kvs) do
|
59
|
+
process_action_without_oboe(method_name, *args)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def render_with_oboe(*args)
|
64
|
+
Oboe::API.trace('actionview', {}) do
|
65
|
+
render_without_oboe(*args)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if defined?(ActionController::Base) and Oboe::Config[:action_controller][:enabled]
|
73
|
+
if ::Rails::VERSION::MAJOR == 4
|
74
|
+
|
75
|
+
class ActionController::Base
|
76
|
+
include Oboe::Inst::Rails4ActionController
|
77
|
+
end
|
78
|
+
|
79
|
+
elsif ::Rails::VERSION::MAJOR == 3
|
80
|
+
|
81
|
+
class ActionController::Base
|
82
|
+
include Oboe::Inst::Rails3ActionController
|
83
|
+
end
|
84
|
+
|
85
|
+
elsif ::Rails::VERSION::MAJOR == 2
|
86
|
+
|
87
|
+
ActionController::Base.class_eval do
|
88
|
+
alias :perform_action_without_oboe :perform_action
|
89
|
+
alias :rescue_action_without_oboe :rescue_action
|
90
|
+
alias :process_without_oboe :process
|
91
|
+
alias :render_without_oboe :render
|
92
|
+
|
93
|
+
def process(*args)
|
94
|
+
Oboe::API.trace('rails', {}) do
|
95
|
+
process_without_oboe(*args)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def perform_action(*arguments)
|
100
|
+
report_kvs = {
|
101
|
+
:Controller => @_request.path_parameters['controller'],
|
102
|
+
:Action => @_request.path_parameters['action']
|
103
|
+
}
|
104
|
+
Oboe::API.log(nil, 'info', report_kvs)
|
105
|
+
perform_action_without_oboe(*arguments)
|
106
|
+
end
|
107
|
+
|
108
|
+
def rescue_action(exn)
|
109
|
+
Oboe::API.log_exception(nil, exn)
|
110
|
+
rescue_action_without_oboe(exn)
|
111
|
+
end
|
112
|
+
|
113
|
+
def render(options = nil, extra_options = {}, &block)
|
114
|
+
Oboe::API.trace('actionview', {}) do
|
115
|
+
render_without_oboe(options, extra_options, &block)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
Oboe.logger.info "[oboe/loading] Instrumenting actioncontroler" if Oboe::Config[:verbose]
|
121
|
+
end
|
122
|
+
# vim:set expandtab:tabstop=2
|
123
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Copyright (c) 2013 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
|
5
|
+
|
6
|
+
##
|
7
|
+
# ActionView Instrumentation is version dependent. ActionView 2.x is separate
|
8
|
+
# and ActionView 3.0 is a special case.
|
9
|
+
# Everything else goes here. (ActionView 3.1 - 4.0 as of this writing)
|
10
|
+
#
|
11
|
+
if (Rails::VERSION::MAJOR == 3 and Rails::VERSION::MINOR > 0) or Rails::VERSION::MAJOR == 4
|
12
|
+
|
13
|
+
Oboe.logger.info "[oboe/loading] Instrumenting actionview" if Oboe::Config[:verbose]
|
14
|
+
|
15
|
+
ActionView::PartialRenderer.class_eval do
|
16
|
+
alias :render_partial_without_oboe :render_partial
|
17
|
+
def render_partial
|
18
|
+
entry_kvs = {}
|
19
|
+
begin
|
20
|
+
name = Oboe::Util.prettify(@options[:partial]) if @options.is_a?(Hash)
|
21
|
+
entry_kvs[:FunctionName] = :render_partial
|
22
|
+
entry_kvs[:Class] = :PartialRenderer
|
23
|
+
entry_kvs[:Module] = :ActionView
|
24
|
+
entry_kvs[:File] = __FILE__
|
25
|
+
entry_kvs[:LineNumber] = __LINE__
|
26
|
+
rescue
|
27
|
+
end
|
28
|
+
|
29
|
+
Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
|
30
|
+
render_partial_without_oboe
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
alias :render_collection_without_oboe :render_collection
|
35
|
+
def render_collection
|
36
|
+
entry_kvs = {}
|
37
|
+
begin
|
38
|
+
name = Oboe::Util.prettify(@path)
|
39
|
+
entry_kvs[:FunctionName] = :render_collection
|
40
|
+
entry_kvs[:Class] = :PartialRenderer
|
41
|
+
entry_kvs[:Module] = :ActionView
|
42
|
+
entry_kvs[:File] = __FILE__
|
43
|
+
entry_kvs[:LineNumber] = __LINE__
|
44
|
+
rescue
|
45
|
+
end
|
46
|
+
|
47
|
+
Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
|
48
|
+
ret = render_collection_without_oboe
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# vim:set expandtab:tabstop=2
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright (c) 2013 AppNeta, 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 = Oboe::Util.prettify(options[:partial]) 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, Oboe::Config[:action_view][:collect_backtraces]) 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, Oboe::Config[:action_view][:collect_backtraces]) 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) 2013 AppNeta, 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 = Oboe::Util.prettify(@options[:partial]) 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, Oboe::Config[:action_view][:collect_backtraces]) 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 = Oboe::Util.prettify(@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, Oboe::Config[:action_view][:collect_backtraces]) do
|
41
|
+
render_collection_without_oboe
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# vim:set expandtab:tabstop=2
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (c) 2013 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
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'
|
9
|
+
|
10
|
+
if Oboe::Config[:active_record][:enabled]
|
11
|
+
begin
|
12
|
+
adapter = ActiveRecord::Base::connection.adapter_name.downcase
|
13
|
+
|
14
|
+
Oboe::Inst::ConnectionAdapters::FlavorInitializers.mysql if adapter == "mysql"
|
15
|
+
Oboe::Inst::ConnectionAdapters::FlavorInitializers.mysql2 if adapter == "mysql2"
|
16
|
+
Oboe::Inst::ConnectionAdapters::FlavorInitializers.postgresql if adapter == "postgresql"
|
17
|
+
Oboe::Inst::ConnectionAdapters::FlavorInitializers.oracle if adapter == "oracleenhanced"
|
18
|
+
|
19
|
+
rescue StandardError => e
|
20
|
+
Oboe.logger.error "[oboe/error] Oboe/ActiveRecord error: #{e.inspect}"
|
21
|
+
Oboe.logger.debug e.backtrace.join("\n")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
# vim:set expandtab:tabstop=2
|