oboe 2.6.6.1 → 2.6.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Appraisals +6 -16
- data/CHANGELOG.md +30 -14
- data/Gemfile +4 -3
- data/Gemfile.lock +20 -25
- data/Rakefile +5 -1
- data/ext/oboe_metal/extconf.rb +2 -2
- data/gemfiles/mongo.gemfile +33 -0
- data/gemfiles/moped.gemfile +33 -0
- data/lib/base.rb +28 -10
- data/lib/joboe_metal.rb +12 -34
- data/lib/method_profiling.rb +3 -3
- data/lib/oboe/api/layerinit.rb +14 -14
- data/lib/oboe/api/logging.rb +11 -11
- data/lib/oboe/api/profiling.rb +7 -6
- data/lib/oboe/api/tracing.rb +3 -3
- data/lib/oboe/api/util.rb +4 -4
- data/lib/oboe/config.rb +7 -7
- data/lib/oboe/frameworks/padrino.rb +2 -2
- data/lib/oboe/frameworks/rails.rb +11 -11
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +4 -4
- data/lib/oboe/frameworks/rails/inst/action_view.rb +2 -2
- data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/action_view_30.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/active_record.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +3 -3
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +2 -2
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +8 -8
- data/lib/oboe/frameworks/sinatra.rb +33 -3
- data/lib/oboe/frameworks/sinatra/templates.rb +2 -2
- data/lib/oboe/inst/cassandra.rb +19 -19
- data/lib/oboe/inst/dalli.rb +7 -7
- data/lib/oboe/inst/http.rb +5 -5
- data/lib/oboe/inst/memcache.rb +14 -14
- data/lib/oboe/inst/memcached.rb +8 -8
- data/lib/oboe/inst/mongo.rb +2 -2
- data/lib/oboe/inst/moped.rb +29 -29
- data/lib/oboe/inst/rack.rb +3 -3
- data/lib/oboe/inst/redis.rb +24 -24
- data/lib/oboe/inst/resque.rb +4 -4
- data/lib/oboe/loading.rb +6 -6
- data/lib/oboe/logger.rb +4 -4
- data/lib/oboe/version.rb +1 -1
- data/lib/oboe_metal.rb +11 -39
- data/test/frameworks/apps/grape_simple.rb +1 -1
- data/test/frameworks/apps/sinatra_simple.rb +1 -1
- data/test/frameworks/padrino_test.rb +3 -3
- data/test/frameworks/sinatra_test.rb +3 -3
- data/test/instrumentation/cassandra_test.rb +45 -45
- data/test/instrumentation/http_test.rb +6 -6
- data/test/instrumentation/mongo_test.rb +347 -345
- data/test/instrumentation/moped_test.rb +40 -40
- data/test/instrumentation/redis_hashes_test.rb +20 -20
- data/test/instrumentation/redis_keys_test.rb +19 -19
- data/test/instrumentation/redis_lists_test.rb +22 -22
- data/test/instrumentation/redis_misc_test.rb +14 -14
- data/test/instrumentation/redis_sets_test.rb +20 -20
- data/test/instrumentation/redis_sortedsets_test.rb +25 -25
- data/test/instrumentation/redis_strings_test.rb +27 -27
- data/test/instrumentation/resque_test.rb +7 -7
- data/test/minitest_helper.rb +18 -6
- data/test/profiling/method_test.rb +24 -24
- data/test/support/liboboe_settings_test.rb +3 -3
- data/test/support/xtrace_test.rb +2 -2
- metadata +26 -32
- data/gemfiles/rails2.3.gemfile +0 -18
- data/gemfiles/rails2.3.gemfile.lock +0 -95
- data/gemfiles/rails3.0.gemfile +0 -18
- data/gemfiles/rails3.0.gemfile.lock +0 -142
- data/gemfiles/rails3.1.gemfile +0 -18
- data/gemfiles/rails3.1.gemfile.lock +0 -152
- data/gemfiles/rails3.2.gemfile +0 -18
- data/gemfiles/rails3.2.gemfile.lock +0 -150
data/lib/joboe_metal.rb
CHANGED
@@ -15,30 +15,6 @@ module Oboe_metal
|
|
15
15
|
|
16
16
|
class Context
|
17
17
|
class << self
|
18
|
-
attr_accessor :layer_op
|
19
|
-
|
20
|
-
def log(layer, label, options = {}, with_backtrace = false)
|
21
|
-
evt = Oboe::Context.createEvent()
|
22
|
-
evt.addInfo("Layer", layer.to_s)
|
23
|
-
evt.addInfo("Label", label.to_s)
|
24
|
-
|
25
|
-
options.each_pair do |k, v|
|
26
|
-
evt.addInfo(k.to_s, v.to_s)
|
27
|
-
end
|
28
|
-
|
29
|
-
evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
|
30
|
-
|
31
|
-
Oboe.reporter.sendReport(evt)
|
32
|
-
end
|
33
|
-
|
34
|
-
def tracing_layer_op?(operation)
|
35
|
-
if operation.is_a?(Array)
|
36
|
-
return operation.include?(@layer_op)
|
37
|
-
else
|
38
|
-
return @layer_op == operation
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
18
|
def toString
|
43
19
|
md = getMetadata.toString
|
44
20
|
end
|
@@ -52,7 +28,7 @@ module Oboe_metal
|
|
52
28
|
end
|
53
29
|
end
|
54
30
|
end
|
55
|
-
|
31
|
+
|
56
32
|
class Event
|
57
33
|
def self.metadataString(evt)
|
58
34
|
evt.getMetadata.toHexString
|
@@ -62,11 +38,11 @@ module Oboe_metal
|
|
62
38
|
def UdpReporter
|
63
39
|
Java::ComTracelyticsJoboe
|
64
40
|
end
|
65
|
-
|
41
|
+
|
66
42
|
module Metadata
|
67
43
|
Java::ComTracelyticsJoboeMetaData
|
68
44
|
end
|
69
|
-
|
45
|
+
|
70
46
|
module Reporter
|
71
47
|
##
|
72
48
|
# Initialize the Oboe Context, reporter and report the initialization
|
@@ -75,7 +51,7 @@ module Oboe_metal
|
|
75
51
|
begin
|
76
52
|
return unless Oboe.loaded
|
77
53
|
|
78
|
-
Oboe_metal::Context.init()
|
54
|
+
Oboe_metal::Context.init()
|
79
55
|
|
80
56
|
if ENV['RACK_ENV'] == "test"
|
81
57
|
Oboe.reporter = Oboe::FileReporter.new("/tmp/trace_output.bson")
|
@@ -88,36 +64,38 @@ module Oboe_metal
|
|
88
64
|
unless defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino) or defined?(::Grape)
|
89
65
|
Oboe::API.report_init
|
90
66
|
end
|
91
|
-
|
67
|
+
|
92
68
|
rescue Exception => e
|
93
69
|
$stderr.puts e.message
|
94
70
|
raise
|
95
71
|
end
|
96
72
|
end
|
97
|
-
|
73
|
+
|
98
74
|
def self.sendReport(evt)
|
99
75
|
evt.report
|
100
76
|
end
|
101
77
|
end
|
102
78
|
end
|
103
79
|
|
104
|
-
module Oboe
|
80
|
+
module Oboe
|
105
81
|
extend OboeBase
|
106
82
|
include Oboe_metal
|
107
|
-
|
83
|
+
|
108
84
|
class << self
|
109
85
|
def sample?(opts = {})
|
86
|
+
return false unless Oboe.always?
|
87
|
+
|
110
88
|
# Assure defaults since SWIG enforces Strings
|
111
89
|
opts[:layer] ||= ''
|
112
90
|
opts[:xtrace] ||= ''
|
113
91
|
opts['X-TV-Meta'] ||= ''
|
114
92
|
Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
|
115
93
|
end
|
116
|
-
|
94
|
+
|
117
95
|
def set_tracing_mode(mode)
|
118
96
|
# FIXME: TBD
|
119
97
|
end
|
120
|
-
|
98
|
+
|
121
99
|
def set_sample_rate(rate)
|
122
100
|
# FIXME: TBD
|
123
101
|
end
|
data/lib/method_profiling.rb
CHANGED
@@ -30,7 +30,7 @@ module OboeMethodProfiling
|
|
30
30
|
# Safety: Make sure there are no quotes or double quotes to break the class_eval
|
31
31
|
file = file.gsub /[\'\"]/, ''
|
32
32
|
line = line.gsub /[\'\"]/, ''
|
33
|
-
|
33
|
+
|
34
34
|
# profiling via ruby-prof, is it possible to get return value of profiled code?
|
35
35
|
code = "def _oboe_profiled_#{method_name}(*args, &block)
|
36
36
|
entry_kvs = {}
|
@@ -42,7 +42,7 @@ module OboeMethodProfiling
|
|
42
42
|
entry_kvs['Args'] = Oboe::API.pps(*args) if #{store_args}
|
43
43
|
entry_kvs.merge!(::Oboe::API.get_class_name(self))
|
44
44
|
|
45
|
-
Oboe::
|
45
|
+
Oboe::API.log(nil, 'profile_entry', entry_kvs)
|
46
46
|
|
47
47
|
ret = _oboe_orig_#{method_name}(*args, &block)
|
48
48
|
|
@@ -51,7 +51,7 @@ module OboeMethodProfiling
|
|
51
51
|
exit_kvs['ProfileName'] = '#{Oboe::Util.prettify(profile_name)}'
|
52
52
|
exit_kvs['ReturnValue'] = Oboe::API.pps(ret) if #{store_return}
|
53
53
|
|
54
|
-
Oboe::
|
54
|
+
Oboe::API.log(nil, 'profile_exit', exit_kvs)
|
55
55
|
ret
|
56
56
|
end"
|
57
57
|
rescue Exception => e
|
data/lib/oboe/api/layerinit.rb
CHANGED
@@ -16,7 +16,7 @@ module Oboe
|
|
16
16
|
return unless Oboe.loaded
|
17
17
|
|
18
18
|
platform_info = { '__Init' => 1 }
|
19
|
-
|
19
|
+
|
20
20
|
begin
|
21
21
|
platform_info['Force'] = true
|
22
22
|
platform_info['Ruby.Platform.Version'] = RUBY_PLATFORM
|
@@ -34,18 +34,18 @@ module Oboe
|
|
34
34
|
elsif defined?(::Sinatra)
|
35
35
|
platform_info['Ruby.Sinatra.Version'] = "Sinatra-#{::Sinatra::VERSION}"
|
36
36
|
end
|
37
|
-
|
38
|
-
# Report the instrumented libraries
|
37
|
+
|
38
|
+
# Report the instrumented libraries
|
39
39
|
platform_info['Ruby.Cassandra.Version'] = "Cassandra-#{::Cassandra.VERSION}" if defined?(::Cassandra)
|
40
40
|
platform_info['Ruby.Dalli.Version'] = "Dalli-#{::Dalli::VERSION}" if defined?(::Dalli)
|
41
41
|
platform_info['Ruby.MemCache.Version'] = "MemCache-#{::MemCache::VERSION}" if defined?(::MemCache)
|
42
42
|
platform_info['Ruby.Moped.Version'] = "Moped-#{::Moped::VERSION}" if defined?(::Moped)
|
43
43
|
platform_info['Ruby.Redis.Version'] = "Redis-#{::Redis::VERSION}" if defined?(::Redis)
|
44
44
|
platform_info['Ruby.Resque.Version'] = "Resque-#{::Resque::VERSION}" if defined?(::Resque)
|
45
|
-
|
45
|
+
|
46
46
|
# Special case since the Mongo 1.x driver doesn't embed the version number in the gem directly
|
47
47
|
if ::Gem.loaded_specs.has_key?('mongo')
|
48
|
-
platform_info['Ruby.Mongo.Version'] = "Mongo-#{::Gem.loaded_specs['mongo'].version.to_s}"
|
48
|
+
platform_info['Ruby.Mongo.Version'] = "Mongo-#{::Gem.loaded_specs['mongo'].version.to_s}"
|
49
49
|
end
|
50
50
|
|
51
51
|
# Report the server in use (if possible)
|
@@ -66,20 +66,20 @@ module Oboe
|
|
66
66
|
elsif defined?(::WEBrick)
|
67
67
|
platform_info['Ruby.AppContainer.Version'] = "WEBrick-#{::WEBrick::VERSION}"
|
68
68
|
else
|
69
|
-
platform_info['Ruby.AppContainer.Version'] =
|
70
|
-
end
|
71
|
-
|
72
|
-
# If we couldn't load the c extension correctly, report the error to the dashboard.
|
73
|
-
unless Oboe.loaded
|
74
|
-
platform_info['Error'] = "Missing TraceView libraries. Tracing disabled."
|
69
|
+
platform_info['Ruby.AppContainer.Version'] = File.basename($0)
|
75
70
|
end
|
76
|
-
|
77
|
-
rescue StandardError => e
|
71
|
+
|
72
|
+
rescue StandardError, ScriptError => e
|
73
|
+
# Also rescue ScriptError (aka SyntaxError) in case one of the expected
|
74
|
+
# version defines don't exist
|
75
|
+
|
76
|
+
platform_info['Error'] = "Error in layerinit: #{e.message}"
|
77
|
+
|
78
78
|
Oboe.logger.debug "Error in layerinit: #{e.message}"
|
79
79
|
Oboe.logger.debug e.backtrace
|
80
80
|
end
|
81
81
|
|
82
|
-
start_trace(layer, nil, platform_info) { }
|
82
|
+
start_trace(layer, nil, platform_info.merge('Force' => true)) { }
|
83
83
|
end
|
84
84
|
|
85
85
|
##
|
data/lib/oboe/api/logging.rb
CHANGED
@@ -23,7 +23,7 @@ module Oboe
|
|
23
23
|
def log(layer, label, opts={})
|
24
24
|
log_event(layer, label, Oboe::Context.createEvent, opts)
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
# Public: Report an exception.
|
28
28
|
#
|
29
29
|
# layer - The layer the reported event belongs to
|
@@ -49,7 +49,7 @@ module Oboe
|
|
49
49
|
exn.instance_variable_set(:@oboe_logged, true)
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# Public: Decide whether or not to start a trace, and report an event
|
54
54
|
# appropriately.
|
55
55
|
#
|
@@ -61,18 +61,18 @@ module Oboe
|
|
61
61
|
# Returns nothing.
|
62
62
|
def log_start(layer, xtrace, opts={})
|
63
63
|
return if Oboe.never? or (opts.has_key?(:URL) and ::Oboe::Util.static_asset?(opts[:URL]))
|
64
|
-
|
64
|
+
|
65
65
|
if xtrace
|
66
66
|
Oboe::Context.fromString(xtrace)
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
if Oboe.tracing?
|
70
70
|
log_entry(layer, opts)
|
71
|
-
elsif
|
71
|
+
elsif opts.has_key?('Force') or Oboe.sample?(opts.merge(:layer => layer, :xtrace => xtrace))
|
72
72
|
log_event(layer, 'entry', Oboe::Context.startTrace, opts)
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
# Public: Report an exit event.
|
77
77
|
#
|
78
78
|
# layer - The layer the reported event belongs to
|
@@ -84,7 +84,7 @@ module Oboe
|
|
84
84
|
Oboe::Context.clear
|
85
85
|
xtrace
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def log_entry(layer, opts={}, protect_op=nil)
|
89
89
|
Oboe::Context.layer_op = protect_op if protect_op
|
90
90
|
log_event(layer, 'entry', Oboe::Context.createEvent, opts)
|
@@ -94,7 +94,7 @@ module Oboe
|
|
94
94
|
Oboe::Context.layer_op = nil if protect_op
|
95
95
|
log_event(layer, 'exit', Oboe::Context.createEvent, opts)
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
# Internal: Report an event.
|
99
99
|
#
|
100
100
|
# layer - The layer the reported event belongs to
|
@@ -117,13 +117,13 @@ module Oboe
|
|
117
117
|
event.addInfo('Layer', layer.to_s)
|
118
118
|
end
|
119
119
|
event.addInfo('Label', label.to_s)
|
120
|
-
|
120
|
+
|
121
121
|
opts.each do |k, v|
|
122
122
|
event.addInfo(k.to_s, v.to_s) if valid_key? k
|
123
123
|
end if !opts.nil? and opts.any?
|
124
|
-
|
124
|
+
|
125
125
|
Oboe::Reporter.sendReport(event) if Oboe.loaded
|
126
126
|
end
|
127
127
|
end
|
128
|
-
end
|
128
|
+
end
|
129
129
|
end
|
data/lib/oboe/api/profiling.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Oboe
|
5
5
|
module API
|
6
|
-
module Profiling
|
6
|
+
module Profiling
|
7
7
|
|
8
8
|
##
|
9
9
|
# Public: Profile a given block of code. Detect any exceptions thrown by
|
@@ -25,23 +25,24 @@ module Oboe
|
|
25
25
|
#
|
26
26
|
# Returns the result of the block.
|
27
27
|
def profile(profile_name, report_kvs={}, with_backtrace=false)
|
28
|
-
|
28
|
+
|
29
29
|
report_kvs[:Language] ||= :ruby
|
30
30
|
report_kvs[:ProfileName] ||= profile_name
|
31
|
+
report_kvs[:Backtrace] = Oboe::API.backtrace if with_backtrace
|
31
32
|
|
32
|
-
Oboe::
|
33
|
+
Oboe::API.log(nil, 'profile_entry', report_kvs)
|
33
34
|
|
34
|
-
begin
|
35
|
+
begin
|
35
36
|
yield
|
36
37
|
rescue Exception => e
|
37
|
-
log_exception(nil, e)
|
38
|
+
log_exception(nil, e)
|
38
39
|
raise
|
39
40
|
ensure
|
40
41
|
exit_kvs = {}
|
41
42
|
exit_kvs[:Language] = :ruby
|
42
43
|
exit_kvs[:ProfileName] = report_kvs[:ProfileName]
|
43
44
|
|
44
|
-
Oboe::
|
45
|
+
Oboe::API.log(nil, 'profile_exit', exit_kvs)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
data/lib/oboe/api/tracing.rb
CHANGED
@@ -32,10 +32,10 @@ module Oboe
|
|
32
32
|
# Returns the result of the block.
|
33
33
|
def trace(layer, opts={}, protect_op=nil)
|
34
34
|
log_entry(layer, opts, protect_op)
|
35
|
-
begin
|
35
|
+
begin
|
36
36
|
yield
|
37
37
|
rescue Exception => e
|
38
|
-
log_exception(layer, e)
|
38
|
+
log_exception(layer, e)
|
39
39
|
raise
|
40
40
|
ensure
|
41
41
|
log_exit(layer, {}, protect_op)
|
@@ -78,7 +78,7 @@ module Oboe
|
|
78
78
|
begin
|
79
79
|
result = yield
|
80
80
|
rescue Exception => e
|
81
|
-
log_exception(layer, e)
|
81
|
+
log_exception(layer, e)
|
82
82
|
e.instance_variable_set(:@xtrace, log_end(layer))
|
83
83
|
raise
|
84
84
|
end
|
data/lib/oboe/api/util.rb
CHANGED
@@ -56,7 +56,7 @@ module Oboe
|
|
56
56
|
def blacklisted?(addr_port)
|
57
57
|
return false unless Oboe::Config.blacklist
|
58
58
|
|
59
|
-
# Ensure that the blacklist is an array
|
59
|
+
# Ensure that the blacklist is an array
|
60
60
|
unless Oboe::Config.blacklist.is_a?(Array)
|
61
61
|
val = Oboe::Config[:blacklist]
|
62
62
|
Oboe::Config[:blacklist] = [ val.to_s ]
|
@@ -68,7 +68,7 @@ module Oboe
|
|
68
68
|
|
69
69
|
false
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
# Internal: Pretty print a list of arguments for reporting
|
73
73
|
#
|
74
74
|
# args - the list of arguments to work on
|
@@ -99,11 +99,11 @@ module Oboe
|
|
99
99
|
if klass.is_a?(Class) and klass.is_a?(Module)
|
100
100
|
# Class
|
101
101
|
kv["Class"] = klass.to_s
|
102
|
-
|
102
|
+
|
103
103
|
elsif (not klass.is_a?(Class) and not klass.is_a?(Module))
|
104
104
|
# Class instance
|
105
105
|
kv["Class"] = klass.class.to_s
|
106
|
-
|
106
|
+
|
107
107
|
else
|
108
108
|
# Module
|
109
109
|
kv["Module"] = klass.to_s
|
data/lib/oboe/config.rb
CHANGED
@@ -12,7 +12,7 @@ module Oboe
|
|
12
12
|
@@config = {}
|
13
13
|
|
14
14
|
@@instrumentation = [ :cassandra, :dalli, :nethttp, :memcached, :memcache, :mongo,
|
15
|
-
:moped, :rack, :redis, :resque, :action_controller, :action_view,
|
15
|
+
:moped, :rack, :redis, :resque, :action_controller, :action_view,
|
16
16
|
:active_record ]
|
17
17
|
|
18
18
|
##
|
@@ -48,7 +48,7 @@ module Oboe
|
|
48
48
|
# Special instrument specific flags
|
49
49
|
#
|
50
50
|
# :link_workers - associates enqueue operations with the jobs they queue by piggybacking
|
51
|
-
# an additional argument that is stripped prior to job proecessing
|
51
|
+
# an additional argument that is stripped prior to job proecessing
|
52
52
|
# !!Note: Make sure both the queue side and the Resque workers are instrumented
|
53
53
|
# or jobs will fail
|
54
54
|
# (Default: false)
|
@@ -76,7 +76,7 @@ module Oboe
|
|
76
76
|
@@config[:reporter_host] = "127.0.0.1"
|
77
77
|
@@config[:reporter_port] = "7831"
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
@@config[:verbose] = false
|
81
81
|
end
|
82
82
|
|
@@ -103,17 +103,17 @@ module Oboe
|
|
103
103
|
|
104
104
|
if key == :sample_rate
|
105
105
|
unless value.is_a?(Integer) or value.is_a?(Float)
|
106
|
-
raise "oboe :sample_rate must be a number between 1 and 1000000 (1m)"
|
106
|
+
raise "oboe :sample_rate must be a number between 1 and 1000000 (1m)"
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
# Validate :sample_rate value
|
110
110
|
unless value.between?(1, 1e6)
|
111
|
-
raise "oboe :sample_rate must be between 1 and 1000000 (1m)"
|
111
|
+
raise "oboe :sample_rate must be between 1 and 1000000 (1m)"
|
112
112
|
end
|
113
113
|
|
114
114
|
# Assure value is an integer
|
115
115
|
@@config[key.to_sym] = value.to_i
|
116
|
-
|
116
|
+
|
117
117
|
Oboe.set_sample_rate(value)
|
118
118
|
end
|
119
119
|
|
@@ -42,7 +42,7 @@ module Oboe
|
|
42
42
|
end
|
43
43
|
|
44
44
|
if defined?(::Padrino)
|
45
|
-
# This instrumentation is a superset of the Sinatra instrumentation similar
|
45
|
+
# This instrumentation is a superset of the Sinatra instrumentation similar
|
46
46
|
# to how Padrino is a superset of Sinatra itself.
|
47
47
|
::Oboe.logger.info "[oboe/loading] Instrumenting Padrino" if Oboe::Config[:verbose]
|
48
48
|
|
@@ -57,7 +57,7 @@ if defined?(::Padrino)
|
|
57
57
|
if defined?(::Padrino::Rendering)
|
58
58
|
::Oboe::Util.send_include(::Padrino::Rendering::InstanceMethods, ::Oboe::PadrinoInst::Rendering)
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
# Report __Init after fork when in Heroku
|
62
62
|
Oboe::API.report_init unless Oboe.heroku?
|
63
63
|
end
|
@@ -20,12 +20,12 @@ module Oboe
|
|
20
20
|
return raw(ERB.new(@@rum_hdr_tmpl).result)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
rescue
|
23
|
+
rescue StandardError => e
|
24
24
|
Oboe.logger.warn "oboe_rum_header: #{e.message}."
|
25
25
|
return ""
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def oboe_rum_footer
|
30
30
|
begin
|
31
31
|
return unless Oboe::Config.rum_id
|
@@ -34,13 +34,13 @@ module Oboe
|
|
34
34
|
# skip that step for now
|
35
35
|
return raw(@@rum_ftr_tmpl)
|
36
36
|
end
|
37
|
-
rescue
|
37
|
+
rescue StandardError => e
|
38
38
|
Oboe.logger.warn "oboe_rum_footer: #{e.message}."
|
39
39
|
return ""
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end # Helpers
|
43
|
-
|
43
|
+
|
44
44
|
def self.load_initializer
|
45
45
|
# Force load the TraceView Rails initializer if there is one
|
46
46
|
# Prefer oboe.rb but give priority to the legacy tracelytics.rb if it exists
|
@@ -52,7 +52,7 @@ module Oboe
|
|
52
52
|
|
53
53
|
if File.exists?("#{rails_root}/config/initializers/tracelytics.rb")
|
54
54
|
tr_initializer = "#{rails_root}/config/initializers/tracelytics.rb"
|
55
|
-
else
|
55
|
+
else
|
56
56
|
tr_initializer = "#{rails_root}/config/initializers/oboe.rb"
|
57
57
|
end
|
58
58
|
require tr_initializer if File.exists?(tr_initializer)
|
@@ -68,8 +68,8 @@ module Oboe
|
|
68
68
|
Oboe.logger.error "[oboe/loading] Error loading rails insrumentation file '#{f}' : #{e}"
|
69
69
|
end
|
70
70
|
end
|
71
|
-
|
72
|
-
Oboe.logger.info "TraceView oboe gem #{Oboe::Version::STRING} successfully loaded."
|
71
|
+
|
72
|
+
Oboe.logger.info "TraceView oboe gem #{Oboe::Version::STRING} successfully loaded."
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.include_helpers
|
@@ -95,9 +95,9 @@ if defined?(::Rails)
|
|
95
95
|
if ::Rails::VERSION::MAJOR > 2
|
96
96
|
module Oboe
|
97
97
|
class Railtie < ::Rails::Railtie
|
98
|
-
|
98
|
+
|
99
99
|
initializer 'oboe.helpers' do
|
100
|
-
Oboe::Rails.include_helpers
|
100
|
+
Oboe::Rails.include_helpers
|
101
101
|
end
|
102
102
|
|
103
103
|
initializer 'oboe.rack' do |app|
|
@@ -122,7 +122,7 @@ if defined?(::Rails)
|
|
122
122
|
|
123
123
|
Oboe::Rails.load_initializer
|
124
124
|
Oboe::Loading.load_access_key
|
125
|
-
|
125
|
+
|
126
126
|
Rails.configuration.after_initialize do
|
127
127
|
Oboe.logger.info "[oboe/loading] Instrumenting rack" if Oboe::Config[:verbose]
|
128
128
|
Rails.configuration.middleware.insert 0, "Oboe::Rack"
|
@@ -130,7 +130,7 @@ if defined?(::Rails)
|
|
130
130
|
Oboe::Inst.load_instrumentation
|
131
131
|
Oboe::Rails.load_instrumentation
|
132
132
|
Oboe::Rails.include_helpers
|
133
|
-
|
133
|
+
|
134
134
|
# Report __Init after fork when in Heroku
|
135
135
|
Oboe::API.report_init unless Oboe.heroku?
|
136
136
|
end
|