oboe 2.7.15.1-java → 2.7.16.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +15 -2
- data/Rakefile +1 -4
- data/lib/oboe/config.rb +6 -3
- data/lib/oboe/inst/excon.rb +110 -0
- data/lib/oboe/inst/faraday.rb +3 -2
- data/lib/oboe/inst/http.rb +10 -5
- data/lib/oboe/inst/rest-client.rb +38 -0
- data/lib/oboe/inst/sequel.rb +3 -0
- data/lib/oboe/inst/typhoeus.rb +5 -2
- data/lib/oboe/ruby.rb +7 -2
- data/lib/oboe/util.rb +27 -9
- data/lib/oboe/version.rb +1 -1
- data/lib/oboe/xtrace.rb +42 -0
- data/test/instrumentation/excon_test.rb +170 -0
- data/test/instrumentation/faraday_test.rb +20 -7
- data/test/instrumentation/http_test.rb +5 -0
- data/test/instrumentation/rest-client_test.rb +302 -0
- data/test/instrumentation/typhoeus_test.rb +90 -132
- data/test/minitest_helper.rb +38 -0
- data/test/servers/rackapp_8101.rb +22 -0
- data/test/support/config_test.rb +7 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e535361d6ddf6ec6a8dca58b742b50f42ba114
|
4
|
+
data.tar.gz: ef8bc3bc820153012eba2de3fdbd3eb66c36f90c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c7b74535912fea2bb7e7a431b1c8e6800fb042f46b43201ee39e8abd202944783cb4a8cd0edf70bb17d578959a4f6e51b214528071306946def97ef771e0d8e
|
7
|
+
data.tar.gz: dde645f8bdc7320d53cfabe2b2fda1deb2dacd5d107f4e81017e688a2402b4f065b1a63823c555ef29d1e8114a10b1744f040087bc301b595d05c2eda127282c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,19 @@ https://github.com/appneta/oboe-ruby/releases
|
|
4
4
|
|
5
5
|
Dates in this file are in the format MM/DD/YYYY.
|
6
6
|
|
7
|
+
# oboe 2.7.16.1
|
8
|
+
|
9
|
+
This patch release includes:
|
10
|
+
|
11
|
+
* New rest-client instrumentation: #109
|
12
|
+
* New excon instrumentation: #114
|
13
|
+
* Fix `uninitialized constant` on unsupported platforms: #113
|
14
|
+
|
15
|
+
Pushed to Rubygems:
|
16
|
+
|
17
|
+
https://rubygems.org/gems/oboe/versions/2.7.16.1
|
18
|
+
https://rubygems.org/gems/oboe/versions/2.7.16.1-java
|
19
|
+
|
7
20
|
# oboe 2.7.15.1
|
8
21
|
|
9
22
|
This patch release includes:
|
data/Gemfile
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
group :development, :test do
|
4
|
-
gem 'minitest'
|
4
|
+
gem 'minitest', "5.5.1"
|
5
5
|
gem 'minitest-reporters'
|
6
6
|
gem 'rack-test'
|
7
|
-
|
7
|
+
gem 'puma'
|
8
|
+
if RUBY_VERSION < '1.9.3'
|
9
|
+
# i18n 0.7.0 dropped support for Ruby 1.9.2 and older. ActiveSupport
|
10
|
+
# depends on i18n 0.7.0 since v 4.0.5. For < 1.9.2 Ruby support, lock
|
11
|
+
# down to these versions to maintain functionality.
|
12
|
+
gem 'i18n', '< 0.7.0'
|
13
|
+
gem 'activesupport', '< 4.0.5'
|
14
|
+
gem 'appraisal'
|
15
|
+
else
|
8
16
|
gem 'appraisal'
|
9
17
|
end
|
10
18
|
end
|
@@ -33,6 +41,11 @@ gem 'faraday'
|
|
33
41
|
gem 'excon'
|
34
42
|
gem 'typhoeus'
|
35
43
|
gem 'sequel'
|
44
|
+
if RUBY_VERSION >= '1.9.3'
|
45
|
+
# rest-client depends on mime-types gem which only supports
|
46
|
+
# ruby 1.9.3 and up
|
47
|
+
gem 'rest-client'
|
48
|
+
end
|
36
49
|
|
37
50
|
# Database adapter gems needed by sequel
|
38
51
|
if defined?(JRUBY_VERSION)
|
data/Rakefile
CHANGED
data/lib/oboe/config.rb
CHANGED
@@ -12,9 +12,10 @@ module Oboe
|
|
12
12
|
@@config = {}
|
13
13
|
|
14
14
|
@@instrumentation = [:action_controller, :action_view, :active_record,
|
15
|
-
:cassandra, :dalli, :em_http_request, :
|
16
|
-
:
|
17
|
-
:
|
15
|
+
:cassandra, :dalli, :em_http_request, :excon, :faraday,
|
16
|
+
:grape, :nethttp, :memcached, :memcache, :mongo,
|
17
|
+
:moped, :rack, :redis, :resque, :rest_client, :sequel,
|
18
|
+
:typhoeus]
|
18
19
|
##
|
19
20
|
# Return the raw nested hash.
|
20
21
|
#
|
@@ -43,6 +44,7 @@ module Oboe
|
|
43
44
|
Oboe::Config[:faraday][:collect_backtraces] = false
|
44
45
|
Oboe::Config[:grape][:collect_backtraces] = true
|
45
46
|
Oboe::Config[:em_http_request][:collect_backtraces] = false
|
47
|
+
Oboe::Config[:excon][:collect_backtraces] = true
|
46
48
|
Oboe::Config[:memcache][:collect_backtraces] = false
|
47
49
|
Oboe::Config[:memcached][:collect_backtraces] = false
|
48
50
|
Oboe::Config[:mongo][:collect_backtraces] = true
|
@@ -50,6 +52,7 @@ module Oboe
|
|
50
52
|
Oboe::Config[:nethttp][:collect_backtraces] = true
|
51
53
|
Oboe::Config[:redis][:collect_backtraces] = false
|
52
54
|
Oboe::Config[:resque][:collect_backtraces] = true
|
55
|
+
Oboe::Config[:rest_client][:collect_backtraces] = false
|
53
56
|
Oboe::Config[:sequel][:collect_backtraces] = true
|
54
57
|
Oboe::Config[:typhoeus][:collect_backtraces] = false
|
55
58
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
module Inst
|
6
|
+
module ExconConnection
|
7
|
+
def self.included(klass)
|
8
|
+
::Oboe::Util.method_alias(klass, :request, ::Excon::Connection)
|
9
|
+
::Oboe::Util.method_alias(klass, :requests, ::Excon::Connection)
|
10
|
+
end
|
11
|
+
|
12
|
+
def oboe_collect(params)
|
13
|
+
kvs = {}
|
14
|
+
kvs['IsService'] = 1
|
15
|
+
kvs['RemoteProtocol'] = ::Oboe::Util.upcase(@data[:scheme])
|
16
|
+
kvs['RemoteHost'] = @data[:host]
|
17
|
+
|
18
|
+
if @data[:query] && @data[:query].length
|
19
|
+
kvs['ServiceArg'] = @data[:path] + '?' + @data[:query]
|
20
|
+
else
|
21
|
+
kvs['ServiceArg'] = @data[:path]
|
22
|
+
end
|
23
|
+
|
24
|
+
# In the case of HTTP pipelining, params could be an array of
|
25
|
+
# request hashes.
|
26
|
+
if params.is_a?(Array)
|
27
|
+
methods = []
|
28
|
+
params.each do |p|
|
29
|
+
methods << ::Oboe::Util.upcase(p[:method])
|
30
|
+
end
|
31
|
+
kvs['HTTPMethods'] = methods.join(', ')[0..1024]
|
32
|
+
kvs['Pipeline'] = true
|
33
|
+
else
|
34
|
+
kvs['HTTPMethod'] = ::Oboe::Util.upcase(params[:method])
|
35
|
+
end
|
36
|
+
kvs['Backtrace'] = Oboe::API.backtrace if Oboe::Config[:excon][:collect_backtraces]
|
37
|
+
kvs
|
38
|
+
rescue => e
|
39
|
+
Oboe.logger.debug "[oboe/debug] Error capturing excon KVs: #{e.message}"
|
40
|
+
Oboe.logger.debug e.backtrace.join('\n') if ::Oboe::Config[:verbose]
|
41
|
+
end
|
42
|
+
|
43
|
+
def requests_with_oboe(pipeline_params)
|
44
|
+
responses = nil
|
45
|
+
Oboe::API.trace('excon', oboe_collect(pipeline_params)) do
|
46
|
+
responses = requests_without_oboe(pipeline_params)
|
47
|
+
end
|
48
|
+
responses
|
49
|
+
end
|
50
|
+
|
51
|
+
def request_with_oboe(params={}, &block)
|
52
|
+
# If we're not tracing, just do a fast return.
|
53
|
+
# If making HTTP pipeline requests (ordered batched)
|
54
|
+
# then just return as we're tracing from parent
|
55
|
+
# <tt>requests</tt>
|
56
|
+
if !Oboe.tracing? || params[:pipeline]
|
57
|
+
return request_without_oboe(params, &block)
|
58
|
+
end
|
59
|
+
|
60
|
+
begin
|
61
|
+
response_context = nil
|
62
|
+
|
63
|
+
# Avoid cross host tracing for blacklisted domains
|
64
|
+
blacklisted = Oboe::API.blacklisted?(@data[:hostname])
|
65
|
+
|
66
|
+
req_context = Oboe::Context.toString()
|
67
|
+
@data[:headers]['X-Trace'] = req_context unless blacklisted
|
68
|
+
|
69
|
+
kvs = oboe_collect(params)
|
70
|
+
kvs['Blacklisted'] = true if blacklisted
|
71
|
+
|
72
|
+
Oboe::API.log_entry('excon', kvs)
|
73
|
+
kvs.clear
|
74
|
+
|
75
|
+
# The core excon call
|
76
|
+
response = request_without_oboe(params, &block)
|
77
|
+
|
78
|
+
# excon only passes back a hash (datum) for HTTP pipelining...
|
79
|
+
# In that case, we should never arrive here but for the OCD, double check
|
80
|
+
# the datatype before trying to extract pertinent info
|
81
|
+
if response.is_a?(Excon::Response)
|
82
|
+
response_context = response.headers['X-Trace']
|
83
|
+
kvs['HTTPStatus'] = response.status
|
84
|
+
|
85
|
+
# If we get a redirect, report the location header
|
86
|
+
if ((300..308).to_a.include? response.status.to_i) && response.headers.key?("Location")
|
87
|
+
kvs["Location"] = response.headers["Location"]
|
88
|
+
end
|
89
|
+
|
90
|
+
if response_context && !blacklisted
|
91
|
+
Oboe::XTrace.continue_service_context(req_context, response_context)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
response
|
96
|
+
rescue => e
|
97
|
+
Oboe::API.log_exception('excon', e)
|
98
|
+
raise e
|
99
|
+
ensure
|
100
|
+
Oboe::API.log_exit('excon', kvs) unless params[:pipeline]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if Oboe::Config[:excon][:enabled] && defined?(::Excon)
|
108
|
+
::Oboe.logger.info '[oboe/loading] Instrumenting excon' if Oboe::Config[:verbose]
|
109
|
+
::Oboe::Util.send_include(::Excon::Connection, ::Oboe::Inst::ExconConnection)
|
110
|
+
end
|
data/lib/oboe/inst/faraday.rb
CHANGED
@@ -8,13 +8,13 @@ module Oboe
|
|
8
8
|
def run_request_with_oboe(method, url, body, headers, &block)
|
9
9
|
# Only send service KVs if we're not using the Net::HTTP adapter
|
10
10
|
# Otherwise, the Net::HTTP instrumentation will send the service KVs
|
11
|
-
handle_service = !@builder.handlers.include?(Faraday::Adapter::NetHttp)
|
11
|
+
handle_service = !@builder.handlers.include?(Faraday::Adapter::NetHttp) &&
|
12
|
+
!@builder.handlers.include?(Faraday::Adapter::Excon)
|
12
13
|
Oboe::API.log_entry('faraday')
|
13
14
|
|
14
15
|
result = run_request_without_oboe(method, url, body, headers, &block)
|
15
16
|
|
16
17
|
kvs = {}
|
17
|
-
kvs[:HTTPStatus] = result.status
|
18
18
|
kvs['Middleware'] = @builder.handlers
|
19
19
|
kvs['Backtrace'] = Oboe::API.backtrace if Oboe::Config[:faraday][:collect_backtraces]
|
20
20
|
|
@@ -33,6 +33,7 @@ module Oboe
|
|
33
33
|
kvs['RemotePort'] = @url_prefix.port
|
34
34
|
kvs['ServiceArg'] = url
|
35
35
|
kvs['HTTPMethod'] = method
|
36
|
+
kvs[:HTTPStatus] = result.status
|
36
37
|
kvs['Blacklisted'] = true if blacklisted
|
37
38
|
|
38
39
|
# Re-attach net::http edge unless it's blacklisted or if we don't have a
|
data/lib/oboe/inst/http.rb
CHANGED
@@ -7,13 +7,13 @@ if Oboe::Config[:nethttp][:enabled]
|
|
7
7
|
|
8
8
|
Net::HTTP.class_eval do
|
9
9
|
def request_with_oboe(*args, &block)
|
10
|
-
|
10
|
+
# If we're not tracing, just do a fast return. Since
|
11
|
+
# net/http.request calls itself, only trace
|
12
|
+
# once the http session has been started.
|
13
|
+
if !Oboe.tracing? || !started?
|
11
14
|
return request_without_oboe(*args, &block)
|
12
15
|
end
|
13
16
|
|
14
|
-
# If we're not tracing, just do a fast return
|
15
|
-
return request_without_oboe(*args, &block) unless Oboe.tracing?
|
16
|
-
|
17
17
|
# Avoid cross host tracing for blacklisted domains
|
18
18
|
blacklisted = Oboe::API.blacklisted?(addr_port)
|
19
19
|
|
@@ -46,7 +46,7 @@ if Oboe::Config[:nethttp][:enabled]
|
|
46
46
|
xtrace = resp.get_fields('X-Trace')
|
47
47
|
xtrace = xtrace[0] if xtrace && xtrace.is_a?(Array)
|
48
48
|
|
49
|
-
if Oboe::XTrace.valid?(xtrace)
|
49
|
+
if Oboe::XTrace.valid?(xtrace)
|
50
50
|
|
51
51
|
# Assure that we received back a valid X-Trace with the same task_id
|
52
52
|
if task_id == Oboe::XTrace.task_id(xtrace)
|
@@ -59,6 +59,11 @@ if Oboe::Config[:nethttp][:enabled]
|
|
59
59
|
|
60
60
|
opts['HTTPStatus'] = resp.code
|
61
61
|
|
62
|
+
# If we get a redirect, report the location header
|
63
|
+
if ((300..308).to_a.include? resp.code.to_i) && resp.header["Location"]
|
64
|
+
opts["Location"] = resp.header["Location"]
|
65
|
+
end
|
66
|
+
|
62
67
|
next resp
|
63
68
|
ensure
|
64
69
|
# Log the info event with the KVs in opts
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
module Inst
|
6
|
+
module RestClientRequest
|
7
|
+
def self.included(klass)
|
8
|
+
::Oboe::Util.method_alias(klass, :execute, ::RestClient::Request)
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# execute_with_oboe
|
13
|
+
#
|
14
|
+
# The wrapper method for RestClient::Request.execute
|
15
|
+
#
|
16
|
+
def execute_with_oboe & block
|
17
|
+
kvs = {}
|
18
|
+
kvs['Backtrace'] = Oboe::API.backtrace if Oboe::Config[:rest_client][:collect_backtraces]
|
19
|
+
Oboe::API.log_entry("rest-client", kvs)
|
20
|
+
|
21
|
+
# The core rest-client call
|
22
|
+
execute_without_oboe(&block)
|
23
|
+
rescue => e
|
24
|
+
Oboe::API.log_exception('rest-client', e)
|
25
|
+
raise e
|
26
|
+
ensure
|
27
|
+
Oboe::API.log_exit("rest-client")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if Oboe::Config[:rest_client][:enabled]
|
34
|
+
if defined?(::RestClient)
|
35
|
+
Oboe.logger.info '[oboe/loading] Instrumenting rest-client' if Oboe::Config[:verbose]
|
36
|
+
::Oboe::Util.send_include(::RestClient::Request, ::Oboe::Inst::RestClientRequest)
|
37
|
+
end
|
38
|
+
end
|
data/lib/oboe/inst/sequel.rb
CHANGED
data/lib/oboe/inst/typhoeus.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
module Oboe
|
2
5
|
module Inst
|
3
6
|
module TyphoeusRequestOps
|
@@ -30,11 +33,11 @@ module Oboe
|
|
30
33
|
|
31
34
|
uri = URI(response.effective_url)
|
32
35
|
kvs['IsService'] = 1
|
33
|
-
kvs['RemoteProtocol'] = uri.scheme
|
36
|
+
kvs['RemoteProtocol'] = ::Oboe::Util.upcase(uri.scheme)
|
34
37
|
kvs['RemoteHost'] = uri.host
|
35
38
|
kvs['RemotePort'] = uri.port ? uri.port : 80
|
36
39
|
kvs['ServiceArg'] = uri.path
|
37
|
-
kvs['HTTPMethod'] = options[:method]
|
40
|
+
kvs['HTTPMethod'] = ::Oboe::Util.upcase(options[:method])
|
38
41
|
kvs['Blacklisted'] = true if blacklisted
|
39
42
|
|
40
43
|
# Re-attach net::http edge unless it's blacklisted or if we don't have a
|
data/lib/oboe/ruby.rb
CHANGED
@@ -19,8 +19,13 @@ module Oboe
|
|
19
19
|
# will instead be detected at load time and initialization is
|
20
20
|
# automatic.
|
21
21
|
def load
|
22
|
-
|
23
|
-
|
22
|
+
# In case some apps call this manually, make sure
|
23
|
+
# that the gem is fully loaded and not in no-op
|
24
|
+
# mode (e.g. on unsupported platforms etc.)
|
25
|
+
if Oboe.loaded
|
26
|
+
Oboe::Loading.load_access_key
|
27
|
+
Oboe::Inst.load_instrumentation
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
data/lib/oboe/util.rb
CHANGED
@@ -122,6 +122,22 @@ module Oboe
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
+
##
|
126
|
+
# upcase
|
127
|
+
#
|
128
|
+
# Occasionally, we want to send some values in all caps. This is true
|
129
|
+
# for things like HTTP scheme or method. This takes anything and does
|
130
|
+
# it's best to safely convert it to a string (if needed) and convert it
|
131
|
+
# to all uppercase.
|
132
|
+
def upcase(o)
|
133
|
+
if o.is_a?(String) || o.respond_to?(:to_s)
|
134
|
+
o.to_s.upcase
|
135
|
+
else
|
136
|
+
Oboe.logger.debug "[oboe/debug] Oboe::Util.upcase: could not convert #{o.class}"
|
137
|
+
"UNKNOWN"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
125
141
|
##
|
126
142
|
# build_report
|
127
143
|
#
|
@@ -154,14 +170,16 @@ module Oboe
|
|
154
170
|
end
|
155
171
|
|
156
172
|
# Report the instrumented libraries
|
157
|
-
platform_info['Ruby.Cassandra.Version']
|
158
|
-
platform_info['Ruby.Dalli.Version']
|
159
|
-
platform_info['Ruby.
|
160
|
-
platform_info['Ruby.
|
161
|
-
platform_info['Ruby.
|
162
|
-
platform_info['Ruby.
|
163
|
-
platform_info['Ruby.
|
164
|
-
platform_info['Ruby.
|
173
|
+
platform_info['Ruby.Cassandra.Version'] = "Cassandra-#{::Cassandra.VERSION}" if defined?(::Cassandra)
|
174
|
+
platform_info['Ruby.Dalli.Version'] = "Dalli-#{::Dalli::VERSION}" if defined?(::Dalli)
|
175
|
+
platform_info['Ruby.Excon.Version'] = "Excon-#{::Excon::VERSION}" if defined?(::Excon::VERSION)
|
176
|
+
platform_info['Ruby.Faraday.Version'] = "Faraday-#{::Faraday::VERSION}" if defined?(::Faraday)
|
177
|
+
platform_info['Ruby.MemCache.Version'] = "MemCache-#{::MemCache::VERSION}" if defined?(::MemCache)
|
178
|
+
platform_info['Ruby.Moped.Version'] = "Moped-#{::Moped::VERSION}" if defined?(::Moped)
|
179
|
+
platform_info['Ruby.Redis.Version'] = "Redis-#{::Redis::VERSION}" if defined?(::Redis)
|
180
|
+
platform_info['Ruby.Resque.Version'] = "Resque-#{::Resque::VERSION}" if defined?(::Resque)
|
181
|
+
platform_info['Ruby.RestClient.Version'] = "RestClient-#{::RestClient::VERSION}" if defined?(::RestClient::VERSION)
|
182
|
+
platform_info['Ruby.Typhoeus.Version'] = "Typhoeus-#{::Typhoeus::VERSION}" if defined?(::Typhoeus::VERSION)
|
165
183
|
|
166
184
|
# Special case since the Mongo 1.x driver doesn't embed the version number in the gem directly
|
167
185
|
if ::Gem.loaded_specs.key?('mongo')
|
@@ -189,7 +207,7 @@ module Oboe
|
|
189
207
|
platform_info['Ruby.AppContainer.Version'] = "Mongrel2-#{::Mongrel2::VERSION}"
|
190
208
|
elsif defined?(::Trinidad)
|
191
209
|
platform_info['Ruby.AppContainer.Version'] = "Trinidad-#{::Trinidad::VERSION}"
|
192
|
-
elsif defined?(::WEBrick)
|
210
|
+
elsif defined?(::WEBrick::VERSION)
|
193
211
|
platform_info['Ruby.AppContainer.Version'] = "WEBrick-#{::WEBrick::VERSION}"
|
194
212
|
else
|
195
213
|
platform_info['Ruby.AppContainer.Version'] = File.basename($PROGRAM_NAME)
|