oboe 2.7.1.7 → 2.7.2.fuchs1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/Gemfile +2 -0
- data/README.md +3 -3
- data/ext/oboe_metal/extconf.rb +11 -11
- data/lib/joboe_metal.rb +36 -42
- data/lib/oboe.rb +29 -26
- data/lib/oboe/api.rb +4 -0
- data/lib/oboe/api/layerinit.rb +7 -67
- data/lib/oboe/api/logging.rb +50 -28
- data/lib/oboe/api/memcache.rb +7 -5
- data/lib/oboe/api/profiling.rb +4 -4
- data/lib/oboe/api/tracing.rb +6 -5
- data/lib/oboe/api/util.rb +13 -9
- data/lib/oboe/base.rb +55 -16
- data/lib/oboe/config.rb +17 -15
- data/lib/oboe/frameworks/padrino.rb +0 -2
- data/lib/oboe/frameworks/padrino/templates.rb +5 -6
- data/lib/oboe/frameworks/rails.rb +0 -1
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +4 -5
- data/lib/oboe/frameworks/rails/inst/action_view.rb +4 -4
- data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +4 -4
- data/lib/oboe/frameworks/rails/inst/action_view_30.rb +2 -2
- data/lib/oboe/frameworks/rails/inst/active_record.rb +5 -5
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +6 -6
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +3 -3
- data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +3 -3
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +18 -19
- data/lib/oboe/frameworks/sinatra.rb +4 -5
- data/lib/oboe/inst/cassandra.rb +17 -19
- data/lib/oboe/inst/dalli.rb +5 -5
- data/lib/oboe/inst/em-http-request.rb +13 -13
- data/lib/oboe/inst/faraday.rb +71 -0
- data/lib/oboe/inst/http.rb +4 -4
- data/lib/oboe/inst/memcache.rb +7 -10
- data/lib/oboe/inst/memcached.rb +7 -9
- data/lib/oboe/inst/mongo.rb +26 -28
- data/lib/oboe/inst/moped.rb +23 -24
- data/lib/oboe/inst/rack.rb +10 -11
- data/lib/oboe/inst/redis.rb +18 -20
- data/lib/oboe/inst/resque.rb +8 -9
- data/lib/oboe/instrumentation.rb +3 -0
- data/lib/oboe/loading.rb +19 -23
- data/lib/{method_profiling.rb → oboe/method_profiling.rb} +22 -8
- data/lib/oboe/ruby.rb +23 -3
- data/lib/oboe/support.rb +94 -0
- data/lib/oboe/thread_local.rb +9 -1
- data/lib/oboe/util.rb +90 -18
- data/lib/oboe/version.rb +5 -2
- data/lib/oboe/xtrace.rb +20 -24
- data/lib/oboe_metal.rb +16 -13
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +2 -0
- data/test/instrumentation/faraday_test.rb +142 -0
- data/test/instrumentation/moped_test.rb +2 -0
- data/test/minitest_helper.rb +0 -1
- data/test/support/config_test.rb +3 -1
- metadata +10 -5
@@ -1,16 +1,16 @@
|
|
1
1
|
# Copyright (c) 2013 AppNeta, Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
if defined?(ActionView::Base)
|
4
|
+
if defined?(ActionView::Base) && Oboe::Config[:action_view][:enabled]
|
5
5
|
|
6
6
|
##
|
7
7
|
# ActionView Instrumentation is version dependent. ActionView 2.x is separate
|
8
8
|
# and ActionView 3.0 is a special case.
|
9
9
|
# Everything else goes here. (ActionView 3.1 - 4.0 as of this writing)
|
10
10
|
#
|
11
|
-
if (Rails::VERSION::MAJOR == 3
|
11
|
+
if (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR > 0) || Rails::VERSION::MAJOR == 4
|
12
12
|
|
13
|
-
Oboe.logger.info
|
13
|
+
Oboe.logger.info '[oboe/loading] Instrumenting actionview' if Oboe::Config[:verbose]
|
14
14
|
|
15
15
|
ActionView::PartialRenderer.class_eval do
|
16
16
|
alias :render_partial_without_oboe :render_partial
|
@@ -45,7 +45,7 @@ if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
|
|
45
45
|
end
|
46
46
|
|
47
47
|
Oboe::API.profile(name, entry_kvs, Oboe::Config[:action_view][:collect_backtraces]) do
|
48
|
-
|
48
|
+
render_collection_without_oboe
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# Copyright (c) 2013 AppNeta, Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
if defined?(ActionView::Base)
|
4
|
+
if defined?(ActionView::Base) && Oboe::Config[:action_view][:enabled]
|
5
5
|
|
6
6
|
if Rails::VERSION::MAJOR == 2
|
7
7
|
|
8
|
-
Oboe.logger.info
|
8
|
+
Oboe.logger.info '[oboe/loading] Instrumenting actionview' if Oboe::Config[:verbose]
|
9
9
|
|
10
10
|
ActionView::Partials.module_eval do
|
11
11
|
alias :render_partial_without_oboe :render_partial
|
12
12
|
def render_partial(options = {})
|
13
|
-
if options.
|
13
|
+
if options.key?(:partial) && options[:partial].is_a?(String)
|
14
14
|
entry_kvs = {}
|
15
15
|
begin
|
16
16
|
name = Oboe::Util.prettify(options[:partial]) if options.is_a?(Hash)
|
@@ -34,7 +34,7 @@ if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
|
|
34
34
|
def render_partial_collection(options = {})
|
35
35
|
entry_kvs = {}
|
36
36
|
begin
|
37
|
-
name =
|
37
|
+
name = 'partial_collection'
|
38
38
|
entry_kvs[:FunctionName] = :render_partial_collection
|
39
39
|
entry_kvs[:Class] = :Partials
|
40
40
|
entry_kvs[:Module] = :ActionView
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2013 AppNeta, Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
if defined?(ActionView::Base)
|
4
|
+
if defined?(ActionView::Base) && Oboe::Config[:action_view][:enabled]
|
5
5
|
|
6
|
-
if Rails::VERSION::MAJOR == 3
|
6
|
+
if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 0
|
7
7
|
|
8
8
|
ActionView::Partials::PartialRenderer.class_eval do
|
9
9
|
alias :render_partial_without_oboe :render_partial
|
@@ -9,12 +9,12 @@ require 'oboe/frameworks/rails/inst/connection_adapters/oracle'
|
|
9
9
|
|
10
10
|
if Oboe::Config[:active_record][:enabled]
|
11
11
|
begin
|
12
|
-
adapter = ActiveRecord::Base
|
12
|
+
adapter = ActiveRecord::Base.connection.adapter_name.downcase
|
13
13
|
|
14
|
-
Oboe::Inst::ConnectionAdapters::FlavorInitializers.mysql if adapter ==
|
15
|
-
Oboe::Inst::ConnectionAdapters::FlavorInitializers.mysql2 if adapter ==
|
16
|
-
Oboe::Inst::ConnectionAdapters::FlavorInitializers.postgresql if adapter ==
|
17
|
-
Oboe::Inst::ConnectionAdapters::FlavorInitializers.oracle if adapter ==
|
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
18
|
|
19
19
|
rescue StandardError => e
|
20
20
|
Oboe.logger.error "[oboe/error] Oboe/ActiveRecord error: #{e.inspect}"
|
@@ -6,20 +6,20 @@ module Oboe
|
|
6
6
|
module ConnectionAdapters
|
7
7
|
module FlavorInitializers
|
8
8
|
def self.mysql
|
9
|
-
Oboe.logger.info
|
9
|
+
Oboe.logger.info '[oboe/loading] Instrumenting activerecord mysqladapter' if Oboe::Config[:verbose]
|
10
10
|
|
11
11
|
# ActiveRecord 3.2 and higher
|
12
|
-
if (::ActiveRecord::VERSION::MAJOR == 3
|
12
|
+
if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR >= 2) ||
|
13
13
|
::ActiveRecord::VERSION::MAJOR == 4
|
14
14
|
|
15
15
|
# AbstractMysqlAdapter
|
16
16
|
Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter,
|
17
|
-
|
17
|
+
::Oboe::Inst::ConnectionAdapters::Utils)
|
18
18
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter, :execute)
|
19
19
|
|
20
20
|
# MysqlAdapter
|
21
21
|
Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::MysqlAdapter,
|
22
|
-
|
22
|
+
::Oboe::Inst::ConnectionAdapters::Utils)
|
23
23
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :exec_query)
|
24
24
|
|
25
25
|
else
|
@@ -27,11 +27,11 @@ module Oboe
|
|
27
27
|
|
28
28
|
# MysqlAdapter
|
29
29
|
Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::MysqlAdapter,
|
30
|
-
|
30
|
+
::Oboe::Inst::ConnectionAdapters::Utils)
|
31
31
|
|
32
32
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :execute)
|
33
33
|
|
34
|
-
if ::ActiveRecord::VERSION::MAJOR == 3
|
34
|
+
if ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 1
|
35
35
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :begin_db_transaction)
|
36
36
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::MysqlAdapter, :exec_delete)
|
37
37
|
end
|
@@ -6,12 +6,12 @@ module Oboe
|
|
6
6
|
module ConnectionAdapters
|
7
7
|
module FlavorInitializers
|
8
8
|
def self.mysql2
|
9
|
-
Oboe.logger.info
|
9
|
+
Oboe.logger.info '[oboe/loading] Instrumenting activerecord mysql2adapter' if Oboe::Config[:verbose]
|
10
10
|
|
11
11
|
Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::Mysql2Adapter,
|
12
|
-
|
12
|
+
::Oboe::Inst::ConnectionAdapters::Utils)
|
13
13
|
|
14
|
-
if (::ActiveRecord::VERSION::MAJOR == 3
|
14
|
+
if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR == 0) ||
|
15
15
|
::ActiveRecord::VERSION::MAJOR == 2
|
16
16
|
# ActiveRecord 3.0 and prior
|
17
17
|
Oboe::Util.method_alias(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, :execute)
|
@@ -6,7 +6,7 @@ module Oboe
|
|
6
6
|
module ConnectionAdapters
|
7
7
|
module FlavorInitializers
|
8
8
|
def self.oracle
|
9
|
-
Oboe.logger.info
|
9
|
+
Oboe.logger.info '[oboe/loading] Instrumenting activerecord oracleenhancedadapter' if Oboe::Config[:verbose]
|
10
10
|
::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.module_eval do
|
11
11
|
include Oboe::Inst::ConnectionAdapters
|
12
12
|
end if defined?(::ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
|
@@ -7,12 +7,12 @@ module Oboe
|
|
7
7
|
module FlavorInitializers
|
8
8
|
def self.postgresql
|
9
9
|
|
10
|
-
Oboe.logger.info
|
10
|
+
Oboe.logger.info '[oboe/loading] Instrumenting activerecord postgresqladapter' if Oboe::Config[:verbose]
|
11
11
|
|
12
12
|
Oboe::Util.send_include(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter,
|
13
|
-
|
13
|
+
::Oboe::Inst::ConnectionAdapters::Utils)
|
14
14
|
|
15
|
-
if (::ActiveRecord::VERSION::MAJOR == 3
|
15
|
+
if (::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR > 0) ||
|
16
16
|
::ActiveRecord::VERSION::MAJOR == 4
|
17
17
|
|
18
18
|
# ActiveRecord 3.1 and up
|
@@ -28,12 +28,12 @@ module Oboe
|
|
28
28
|
config = ::Rails.application.config.database_configuration[::Rails.env]
|
29
29
|
end
|
30
30
|
|
31
|
-
opts[:Database] = config[
|
32
|
-
opts[:RemoteHost] = config[
|
33
|
-
opts[:Flavor] = config[
|
31
|
+
opts[:Database] = config['database'] if config.key?('database')
|
32
|
+
opts[:RemoteHost] = config['host'] if config.key?('host')
|
33
|
+
opts[:Flavor] = config['adapter'] if config.key?('adapter')
|
34
34
|
rescue StandardError => e
|
35
35
|
Oboe.logger.debug "Exception raised capturing ActiveRecord KVs: #{e.inspect}"
|
36
|
-
Oboe.logger.debug e.backtrace.join(
|
36
|
+
Oboe.logger.debug e.backtrace.join('\n')
|
37
37
|
end
|
38
38
|
|
39
39
|
return opts || {}
|
@@ -42,17 +42,17 @@ module Oboe
|
|
42
42
|
# We don't want to trace framework caches. Only instrument SQL that
|
43
43
|
# directly hits the database.
|
44
44
|
def ignore_payload?(name)
|
45
|
-
%w(SCHEMA EXPLAIN CACHE).include?
|
46
|
-
(name
|
47
|
-
name ==
|
45
|
+
%w(SCHEMA EXPLAIN CACHE).include?(name.to_s) ||
|
46
|
+
(name && name.to_sym == :skip_logging) ||
|
47
|
+
name == 'ActiveRecord::SchemaMigration Load'
|
48
48
|
end
|
49
49
|
|
50
|
-
#def cfg
|
51
|
-
#
|
52
|
-
#end
|
50
|
+
# def cfg
|
51
|
+
# @config
|
52
|
+
# end
|
53
53
|
|
54
54
|
def execute_with_oboe(sql, name = nil)
|
55
|
-
if Oboe.tracing?
|
55
|
+
if Oboe.tracing? && !ignore_payload?(name)
|
56
56
|
|
57
57
|
opts = extract_trace_details(sql, name)
|
58
58
|
Oboe::API.trace('activerecord', opts || {}) do
|
@@ -64,7 +64,7 @@ module Oboe
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def exec_query_with_oboe(sql, name = nil, binds = [])
|
67
|
-
if Oboe.tracing?
|
67
|
+
if Oboe.tracing? && !ignore_payload?(name)
|
68
68
|
|
69
69
|
opts = extract_trace_details(sql, name, binds)
|
70
70
|
Oboe::API.trace('activerecord', opts || {}) do
|
@@ -76,7 +76,7 @@ module Oboe
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def exec_delete_with_oboe(sql, name = nil, binds = [])
|
79
|
-
if Oboe.tracing?
|
79
|
+
if Oboe.tracing? && !ignore_payload?(name)
|
80
80
|
|
81
81
|
opts = extract_trace_details(sql, name, binds)
|
82
82
|
Oboe::API.trace('activerecord', opts || {}) do
|
@@ -88,7 +88,7 @@ module Oboe
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def exec_insert_with_oboe(sql, name = nil, binds = [], *args)
|
91
|
-
if Oboe.tracing?
|
91
|
+
if Oboe.tracing? && !ignore_payload?(name)
|
92
92
|
|
93
93
|
opts = extract_trace_details(sql, name, binds)
|
94
94
|
Oboe::API.trace('activerecord', opts || {}) do
|
@@ -99,20 +99,19 @@ module Oboe
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
def begin_db_transaction_with_oboe
|
102
|
+
def begin_db_transaction_with_oboe
|
103
103
|
if Oboe.tracing?
|
104
104
|
opts = {}
|
105
105
|
|
106
|
-
opts[:Query] =
|
106
|
+
opts[:Query] = 'BEGIN'
|
107
107
|
Oboe::API.trace('activerecord', opts || {}) do
|
108
|
-
begin_db_transaction_without_oboe
|
108
|
+
begin_db_transaction_without_oboe
|
109
109
|
end
|
110
110
|
else
|
111
|
-
begin_db_transaction_without_oboe
|
111
|
+
begin_db_transaction_without_oboe
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end # Utils
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
118
|
-
|
@@ -52,7 +52,7 @@ module Oboe
|
|
52
52
|
end
|
53
53
|
rescue StandardError => e
|
54
54
|
Oboe.logger.warn "oboe_rum_header: #{e.message}."
|
55
|
-
return
|
55
|
+
return ''
|
56
56
|
end
|
57
57
|
|
58
58
|
def oboe_rum_footer
|
@@ -64,7 +64,7 @@ module Oboe
|
|
64
64
|
end
|
65
65
|
rescue StandardError => e
|
66
66
|
Oboe.logger.warn "oboe_rum_footer: #{e.message}."
|
67
|
-
return
|
67
|
+
return ''
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -74,7 +74,7 @@ if defined?(::Sinatra)
|
|
74
74
|
require 'oboe/inst/rack'
|
75
75
|
require 'oboe/frameworks/sinatra/templates'
|
76
76
|
|
77
|
-
Oboe.logger.info
|
77
|
+
Oboe.logger.info '[oboe/loading] Instrumenting Sinatra' if Oboe::Config[:verbose]
|
78
78
|
|
79
79
|
Oboe::Loading.load_access_key
|
80
80
|
Oboe::Inst.load_instrumentation
|
@@ -83,7 +83,7 @@ if defined?(::Sinatra)
|
|
83
83
|
|
84
84
|
# When in the gem TEST environment, we load this instrumentation regardless.
|
85
85
|
# Otherwise, only when Padrino isn't around.
|
86
|
-
unless defined?(::Padrino) and not (ENV.
|
86
|
+
unless defined?(::Padrino) and not (ENV.key?('OBOE_GEM_TEST'))
|
87
87
|
# Padrino has 'enhanced' routes and rendering so the Sinatra
|
88
88
|
# instrumentation won't work anyways. Only load for pure Sinatra apps.
|
89
89
|
::Oboe::Util.send_include(::Sinatra::Base, ::Oboe::Sinatra::Base)
|
@@ -93,4 +93,3 @@ if defined?(::Sinatra)
|
|
93
93
|
Oboe::API.report_init unless Oboe.heroku?
|
94
94
|
end
|
95
95
|
end
|
96
|
-
|
data/lib/oboe/inst/cassandra.rb
CHANGED
@@ -13,25 +13,25 @@ module Oboe
|
|
13
13
|
report_kvs[:Key] = keys.inspect if keys
|
14
14
|
|
15
15
|
# Open issue - how to handle multiple Cassandra servers
|
16
|
-
report_kvs[:RemoteHost], report_kvs[:RemotePort] = @servers.first.split(
|
16
|
+
report_kvs[:RemoteHost], report_kvs[:RemotePort] = @servers.first.split(':')
|
17
17
|
|
18
18
|
report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:cassandra][:collect_backtraces]
|
19
19
|
|
20
|
-
if options.empty?
|
20
|
+
if options.empty? && args.is_a?(Array)
|
21
21
|
options = args.last if args.last.is_a?(Hash)
|
22
22
|
end
|
23
23
|
|
24
24
|
unless options.empty?
|
25
25
|
[:start_key, :finish_key, :key_count, :batch_size, :columns, :count, :start,
|
26
26
|
:stop, :finish, :finished, :reversed, :consistency, :ttl].each do |k|
|
27
|
-
report_kvs[k.to_s.capitalize] = options[k] if options.
|
27
|
+
report_kvs[k.to_s.capitalize] = options[k] if options.key?(k)
|
28
28
|
end
|
29
29
|
|
30
30
|
if op == :get_indexed_slices
|
31
31
|
index_clause = columns_and_options[:index_clause] || {}
|
32
32
|
unless index_clause.empty?
|
33
33
|
[:column_name, :value, :comparison].each do |k|
|
34
|
-
report_kvs[k.to_s.capitalize] = index_clause[k] if index_clause.
|
34
|
+
report_kvs[k.to_s.capitalize] = index_clause[k] if index_clause.key?(k)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -77,7 +77,7 @@ module Oboe
|
|
77
77
|
def get_columns_with_oboe(column_family, key, *columns_and_options)
|
78
78
|
args = [column_family, key] + columns_and_options
|
79
79
|
|
80
|
-
if Oboe.tracing?
|
80
|
+
if Oboe.tracing? && !Oboe.tracing_layer_op?(:multi_get_columns)
|
81
81
|
report_kvs = extract_trace_details(:get_columns, column_family, key, columns_and_options)
|
82
82
|
|
83
83
|
Oboe::API.trace('cassandra', report_kvs) do
|
@@ -113,7 +113,7 @@ module Oboe
|
|
113
113
|
def multi_get_with_oboe(column_family, key, *columns_and_options)
|
114
114
|
args = [column_family, key] + columns_and_options
|
115
115
|
|
116
|
-
if Oboe.tracing?
|
116
|
+
if Oboe.tracing? && !Oboe.tracing_layer_op?(:get)
|
117
117
|
report_kvs = extract_trace_details(:multi_get, column_family, key, columns_and_options)
|
118
118
|
|
119
119
|
Oboe::API.trace('cassandra', report_kvs) do
|
@@ -136,9 +136,8 @@ module Oboe
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def get_range_single_with_oboe(column_family, options = {})
|
139
|
-
if Oboe.tracing?
|
139
|
+
if Oboe.tracing? && !Oboe.tracing_layer_op?(:get_range_batch)
|
140
140
|
report_kvs = extract_trace_details(:get_range_single, column_family, nil, nil)
|
141
|
-
args = [column_family, options]
|
142
141
|
|
143
142
|
Oboe::API.trace('cassandra', report_kvs) do
|
144
143
|
get_range_single_without_oboe(column_family, options)
|
@@ -152,7 +151,6 @@ module Oboe
|
|
152
151
|
return get_range_batch_without_oboe(column_family, options) unless Oboe.tracing?
|
153
152
|
|
154
153
|
report_kvs = extract_trace_details(:get_range_batch, column_family, nil, nil)
|
155
|
-
args = [column_family, options]
|
156
154
|
|
157
155
|
Oboe::API.trace('cassandra', report_kvs, :get_range_batch) do
|
158
156
|
get_range_batch_without_oboe(column_family, options)
|
@@ -208,7 +206,7 @@ module Oboe
|
|
208
206
|
|
209
207
|
report_kvs = extract_trace_details(:add_column_family, nil, nil, nil)
|
210
208
|
begin
|
211
|
-
report_kvs[:Cf] = cf_def[:name] if cf_def.is_a?(Hash)
|
209
|
+
report_kvs[:Cf] = cf_def[:name] if cf_def.is_a?(Hash) && cf_def.key?(:name)
|
212
210
|
rescue
|
213
211
|
end
|
214
212
|
|
@@ -231,7 +229,7 @@ module Oboe
|
|
231
229
|
return add_keyspace_without_oboe(ks_def) unless Oboe.tracing?
|
232
230
|
|
233
231
|
report_kvs = extract_trace_details(:add_keyspace, nil, nil, nil)
|
234
|
-
report_kvs[:Name] = ks_def.name rescue
|
232
|
+
report_kvs[:Name] = ks_def.name rescue ''
|
235
233
|
|
236
234
|
Oboe::API.trace('cassandra', report_kvs) do
|
237
235
|
add_keyspace_without_oboe(ks_def)
|
@@ -242,7 +240,7 @@ module Oboe
|
|
242
240
|
return drop_keyspace_without_oboe(keyspace) unless Oboe.tracing?
|
243
241
|
|
244
242
|
report_kvs = extract_trace_details(:drop_keyspace, nil, nil, nil)
|
245
|
-
report_kvs[:Name] = keyspace.to_s rescue
|
243
|
+
report_kvs[:Name] = keyspace.to_s rescue ''
|
246
244
|
|
247
245
|
Oboe::API.trace('cassandra', report_kvs) do
|
248
246
|
drop_keyspace_without_oboe(keyspace)
|
@@ -252,16 +250,16 @@ module Oboe
|
|
252
250
|
end
|
253
251
|
end
|
254
252
|
|
255
|
-
if defined?(::Cassandra)
|
256
|
-
Oboe.logger.info
|
253
|
+
if defined?(::Cassandra) && Oboe::Config[:cassandra][:enabled]
|
254
|
+
Oboe.logger.info '[oboe/loading] Instrumenting cassandra' if Oboe::Config[:verbose]
|
257
255
|
|
258
256
|
class ::Cassandra
|
259
257
|
include Oboe::Inst::Cassandra
|
260
258
|
|
261
|
-
[
|
262
|
-
|
263
|
-
|
264
|
-
|
259
|
+
[:insert, :remove, :count_columns, :get_columns, :multi_get_columns, :get,
|
260
|
+
:multi_get, :get_range_single, :get_range_batch, :get_indexed_slices,
|
261
|
+
:create_index, :drop_index, :add_column_family, :drop_column_family,
|
262
|
+
:add_keyspace, :drop_keyspace].each do |m|
|
265
263
|
if method_defined?(m)
|
266
264
|
class_eval "alias #{m}_without_oboe #{m}"
|
267
265
|
class_eval "alias #{m} #{m}_with_oboe"
|
@@ -273,7 +271,7 @@ if defined?(::Cassandra) and Oboe::Config[:cassandra][:enabled]
|
|
273
271
|
if method_defined?(:exists?)
|
274
272
|
alias exists_without_oboe? exists?
|
275
273
|
alias exists? exists_with_oboe?
|
276
|
-
else Oboe.logger.warn
|
274
|
+
else Oboe.logger.warn '[oboe/loading] Couldn\'t properly instrument Cassandra (exists?). Partial traces may occur.'
|
277
275
|
end
|
278
276
|
end # class Cassandra
|
279
277
|
end
|
data/lib/oboe/inst/dalli.rb
CHANGED
@@ -8,11 +8,11 @@ module Oboe
|
|
8
8
|
|
9
9
|
def self.included(cls)
|
10
10
|
cls.class_eval do
|
11
|
-
Oboe.logger.info
|
11
|
+
Oboe.logger.info '[oboe/loading] Instrumenting memcache (dalli)' if Oboe::Config[:verbose]
|
12
12
|
if ::Dalli::Client.private_method_defined? :perform
|
13
13
|
alias perform_without_oboe perform
|
14
14
|
alias perform perform_with_oboe
|
15
|
-
else Oboe.logger.warn
|
15
|
+
else Oboe.logger.warn '[oboe/loading] Couldn\'t properly instrument Memcache (Dalli). Partial traces may occur.'
|
16
16
|
end
|
17
17
|
|
18
18
|
if ::Dalli::Client.method_defined? :get_multi
|
@@ -25,12 +25,12 @@ module Oboe
|
|
25
25
|
def perform_with_oboe(*all_args, &blk)
|
26
26
|
op, key, *args = *all_args
|
27
27
|
|
28
|
-
if Oboe.tracing?
|
28
|
+
if Oboe.tracing? && !Oboe.tracing_layer_op?(:get_multi)
|
29
29
|
Oboe::API.trace('memcache', { :KVOp => op, :KVKey => key }) do
|
30
30
|
result = perform_without_oboe(*all_args, &blk)
|
31
31
|
|
32
32
|
info_kvs = {}
|
33
|
-
info_kvs[:KVHit] = memcache_hit?(result) if op == :get
|
33
|
+
info_kvs[:KVHit] = memcache_hit?(result) if op == :get && key.class == String
|
34
34
|
info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:dalli][:collect_backtraces]
|
35
35
|
|
36
36
|
Oboe::API.log('memcache', 'info', info_kvs) unless info_kvs.empty?
|
@@ -68,7 +68,7 @@ module Oboe
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
if defined?(Dalli)
|
71
|
+
if defined?(Dalli) && Oboe::Config[:dalli][:enabled]
|
72
72
|
::Dalli::Client.module_eval do
|
73
73
|
include Oboe::Inst::Dalli
|
74
74
|
end
|