oboe 2.7.16.1-java → 2.7.17.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +2 -0
- data/lib/oboe/config.rb +62 -13
- data/lib/oboe/inst/excon.rb +2 -1
- data/lib/oboe/inst/http.rb +8 -1
- data/lib/oboe/inst/httpclient.rb +173 -0
- data/lib/oboe/inst/rack.rb +6 -3
- data/lib/oboe/inst/typhoeus.rb +9 -5
- data/lib/oboe/util.rb +20 -0
- data/lib/oboe/version.rb +1 -1
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +33 -15
- data/test/instrumentation/excon_test.rb +66 -29
- data/test/instrumentation/faraday_test.rb +108 -63
- data/test/instrumentation/http_test.rb +63 -26
- data/test/instrumentation/httpclient_test.rb +296 -0
- data/test/instrumentation/rack_test.rb +40 -1
- data/test/instrumentation/rest-client_test.rb +65 -71
- data/test/instrumentation/typhoeus_test.rb +32 -25
- data/test/minitest_helper.rb +1 -0
- data/test/support/config_test.rb +52 -2
- metadata +30 -27
data/lib/oboe/version.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# AppNeta TraceView Initializer (the oboe gem)
|
2
2
|
# http://www.appneta.com/products/traceview/
|
3
3
|
#
|
4
|
-
# Details on configuring your sample rate:
|
5
|
-
# https://support.appneta.com/cloud/configuring-sampling
|
6
|
-
#
|
7
4
|
# More information on instrumenting Ruby applications can be found here:
|
8
5
|
# https://support.appneta.com/cloud/installing-ruby-instrumentation
|
9
6
|
|
@@ -15,12 +12,36 @@ if defined?(Oboe::Config)
|
|
15
12
|
# order to initiate tracing from Ruby.
|
16
13
|
Oboe::Config[:tracing_mode] = '<%= @tracing_mode %>'
|
17
14
|
|
18
|
-
# sample_rate is a value from 0 - 1m indicating the fraction of requests per million to trace
|
19
|
-
# Oboe::Config[:sample_rate] = <%= @sample_rate %>
|
20
|
-
|
21
15
|
# Verbose output of instrumentation initialization
|
22
16
|
# Oboe::Config[:verbose] = <%= @verbose %>
|
23
17
|
|
18
|
+
# Logging of outgoing HTTP query args
|
19
|
+
#
|
20
|
+
# This optionally disables the logging of query args of outgoing
|
21
|
+
# HTTP clients such as Net::HTTP, excon, typhoeus and others.
|
22
|
+
#
|
23
|
+
# This flag is global to all HTTP client instrumentation.
|
24
|
+
#
|
25
|
+
# To configure this on a per instrumentation basis, set this
|
26
|
+
# option to true and instead disable the instrumenstation specific
|
27
|
+
# option <tt>log_args</tt>:
|
28
|
+
#
|
29
|
+
# Oboe::Config[:nethttp][:log_args] = false
|
30
|
+
# Oboe::Config[:excon][:log_args] = false
|
31
|
+
# Oboe::Config[:typhoeus][:log_args] = true
|
32
|
+
#
|
33
|
+
Oboe::Config[:include_url_query_params] = true
|
34
|
+
|
35
|
+
# Logging of incoming HTTP query args
|
36
|
+
#
|
37
|
+
# This optionally disables the logging of incoming URL request
|
38
|
+
# query args.
|
39
|
+
#
|
40
|
+
# This flag is global and currently only affects the Rack
|
41
|
+
# instrumentation which reports incoming request URLs and
|
42
|
+
# query args by default.
|
43
|
+
Oboe::Config[:include_remote_url_params] = true
|
44
|
+
|
24
45
|
# The oboe Ruby client has the ability to sanitize query literals
|
25
46
|
# from SQL statements. By default this is disabled. Enable to
|
26
47
|
# avoid collecting and reporting query literals to TraceView.
|
@@ -77,8 +98,10 @@ if defined?(Oboe::Config)
|
|
77
98
|
# Oboe::Config[:action_view][:enabled] = true
|
78
99
|
# Oboe::Config[:cassandra][:enabled] = true
|
79
100
|
# Oboe::Config[:dalli][:enabled] = true
|
101
|
+
# Oboe::Config[:excon][:enabled] = true
|
80
102
|
# Oboe::Config[:em_http_request][:enabled] = true
|
81
103
|
# Oboe::Config[:faraday][:enabled] = true
|
104
|
+
# Oboe::Config[:httpclient][:enabled] = true
|
82
105
|
# Oboe::Config[:memcache][:enabled] = true
|
83
106
|
# Oboe::Config[:memcached][:enabled] = true
|
84
107
|
# Oboe::Config[:mongo][:enabled] = true
|
@@ -86,6 +109,7 @@ if defined?(Oboe::Config)
|
|
86
109
|
# Oboe::Config[:nethttp][:enabled] = true
|
87
110
|
# Oboe::Config[:redis][:enabled] = true
|
88
111
|
# Oboe::Config[:resque][:enabled] = true
|
112
|
+
# Oboe::Config[:rest_client][:enabled] = true
|
89
113
|
# Oboe::Config[:sequel][:enabled] = true
|
90
114
|
# Oboe::Config[:typhoeus][:enabled] = true
|
91
115
|
#
|
@@ -103,8 +127,10 @@ if defined?(Oboe::Config)
|
|
103
127
|
# Oboe::Config[:action_view][:collect_backtraces] = true
|
104
128
|
# Oboe::Config[:cassandra][:collect_backtraces] = true
|
105
129
|
# Oboe::Config[:dalli][:collect_backtraces] = false
|
130
|
+
# Oboe::Config[:excon][:collect_backtraces] = false
|
106
131
|
# Oboe::Config[:em_http_request][:collect_backtraces] = true
|
107
132
|
# Oboe::Config[:faraday][:collect_backtraces] = false
|
133
|
+
# Oboe::Config[:httpclient][:collect_backtraces] = false
|
108
134
|
# Oboe::Config[:memcache][:collect_backtraces] = false
|
109
135
|
# Oboe::Config[:memcached][:collect_backtraces] = false
|
110
136
|
# Oboe::Config[:mongo][:collect_backtraces] = true
|
@@ -112,19 +138,11 @@ if defined?(Oboe::Config)
|
|
112
138
|
# Oboe::Config[:nethttp][:collect_backtraces] = true
|
113
139
|
# Oboe::Config[:redis][:collect_backtraces] = false
|
114
140
|
# Oboe::Config[:resque][:collect_backtraces] = true
|
141
|
+
# Oboe::Config[:rest_client][:collect_backtraces] = true
|
115
142
|
# Oboe::Config[:sequel][:collect_backtraces] = true
|
116
143
|
# Oboe::Config[:typhoeus][:collect_backtraces] = false
|
117
144
|
#
|
118
145
|
|
119
|
-
#
|
120
|
-
# Blacklist actions
|
121
|
-
#
|
122
|
-
# e.g. if your load balancer requests 'index#ok'
|
123
|
-
#
|
124
|
-
# Oboe::Config[:action_blacklist] = {
|
125
|
-
# 'index#ok' => true
|
126
|
-
# }
|
127
|
-
|
128
146
|
#
|
129
147
|
# Resque Options
|
130
148
|
#
|
@@ -51,23 +51,24 @@ class ExconTest < Minitest::Test
|
|
51
51
|
clear_all_traces
|
52
52
|
|
53
53
|
Oboe::API.start_trace('excon_tests') do
|
54
|
-
response = Excon.get('http://
|
54
|
+
response = Excon.get('http://127.0.0.1:8101/?blah=1')
|
55
55
|
xtrace = response.headers['X-Trace']
|
56
56
|
assert xtrace
|
57
57
|
assert Oboe::XTrace.valid?(xtrace)
|
58
58
|
end
|
59
59
|
|
60
60
|
traces = get_all_traces
|
61
|
-
assert_equal traces.count,
|
61
|
+
assert_equal traces.count, 7
|
62
62
|
validate_outer_layers(traces, "excon_tests")
|
63
|
+
valid_edges?(traces)
|
63
64
|
|
64
65
|
assert_equal traces[1]['IsService'], 1
|
65
|
-
assert_equal traces[1]['RemoteHost'], '
|
66
|
+
assert_equal traces[1]['RemoteHost'], '127.0.0.1'
|
66
67
|
assert_equal traces[1]['RemoteProtocol'], 'HTTP'
|
67
|
-
assert_equal traces[1]['ServiceArg'], '
|
68
|
+
assert_equal traces[1]['ServiceArg'], '/?blah=1'
|
68
69
|
assert_equal traces[1]['HTTPMethod'], 'GET'
|
69
70
|
assert traces[1].key?('Backtrace')
|
70
|
-
assert_equal traces[
|
71
|
+
assert_equal traces[5]['HTTPStatus'], 200
|
71
72
|
end
|
72
73
|
|
73
74
|
def test_persistent_requests
|
@@ -77,39 +78,40 @@ class ExconTest < Minitest::Test
|
|
77
78
|
clear_all_traces
|
78
79
|
|
79
80
|
Oboe::API.start_trace('excon_tests') do
|
80
|
-
connection = Excon.new('http://
|
81
|
+
connection = Excon.new('http://127.0.0.1:8101/') # non-persistent by default
|
81
82
|
connection.get # socket established, then closed
|
82
83
|
connection.get(:persistent => true) # socket established, left open
|
83
84
|
connection.get # socket reused, then closed
|
84
85
|
end
|
85
86
|
|
86
87
|
traces = get_all_traces
|
87
|
-
assert_equal traces.count,
|
88
|
+
assert_equal traces.count, 17
|
88
89
|
validate_outer_layers(traces, "excon_tests")
|
90
|
+
valid_edges?(traces)
|
89
91
|
|
90
92
|
assert_equal traces[1]['IsService'], 1
|
91
|
-
assert_equal traces[1]['RemoteHost'], '
|
93
|
+
assert_equal traces[1]['RemoteHost'], '127.0.0.1'
|
92
94
|
assert_equal traces[1]['RemoteProtocol'], 'HTTP'
|
93
95
|
assert_equal traces[1]['ServiceArg'], '/'
|
94
96
|
assert_equal traces[1]['HTTPMethod'], 'GET'
|
95
97
|
assert traces[1].key?('Backtrace')
|
96
|
-
assert_equal traces[
|
97
|
-
|
98
|
-
assert_equal traces[
|
99
|
-
assert_equal traces[
|
100
|
-
assert_equal traces[
|
101
|
-
assert_equal traces[
|
102
|
-
assert_equal traces[
|
103
|
-
assert traces[
|
104
|
-
assert_equal traces[
|
105
|
-
|
106
|
-
assert_equal traces[
|
107
|
-
assert_equal traces[
|
108
|
-
assert_equal traces[
|
109
|
-
assert_equal traces[
|
110
|
-
assert_equal traces[
|
111
|
-
assert traces[
|
112
|
-
assert_equal traces[
|
98
|
+
assert_equal traces[5]['HTTPStatus'], 200
|
99
|
+
|
100
|
+
assert_equal traces[6]['IsService'], 1
|
101
|
+
assert_equal traces[6]['RemoteHost'], '127.0.0.1'
|
102
|
+
assert_equal traces[6]['RemoteProtocol'], 'HTTP'
|
103
|
+
assert_equal traces[6]['ServiceArg'], '/'
|
104
|
+
assert_equal traces[6]['HTTPMethod'], 'GET'
|
105
|
+
assert traces[6].key?('Backtrace')
|
106
|
+
assert_equal traces[10]['HTTPStatus'], 200
|
107
|
+
|
108
|
+
assert_equal traces[11]['IsService'], 1
|
109
|
+
assert_equal traces[11]['RemoteHost'], '127.0.0.1'
|
110
|
+
assert_equal traces[11]['RemoteProtocol'], 'HTTP'
|
111
|
+
assert_equal traces[11]['ServiceArg'], '/'
|
112
|
+
assert_equal traces[11]['HTTPMethod'], 'GET'
|
113
|
+
assert traces[11].key?('Backtrace')
|
114
|
+
assert_equal traces[15]['HTTPStatus'], 200
|
113
115
|
end
|
114
116
|
|
115
117
|
def test_pipelined_requests
|
@@ -118,17 +120,17 @@ class ExconTest < Minitest::Test
|
|
118
120
|
clear_all_traces
|
119
121
|
|
120
122
|
Oboe::API.start_trace('excon_tests') do
|
121
|
-
connection = Excon.new('http://
|
123
|
+
connection = Excon.new('http://127.0.0.1:8101/')
|
122
124
|
connection.requests([{:method => :get}, {:method => :put}])
|
123
125
|
end
|
124
126
|
|
125
127
|
traces = get_all_traces
|
126
|
-
assert_equal traces.count,
|
128
|
+
assert_equal traces.count, 10
|
127
129
|
validate_outer_layers(traces, "excon_tests")
|
128
130
|
valid_edges?(traces)
|
129
131
|
|
130
132
|
assert_equal traces[1]['IsService'], 1
|
131
|
-
assert_equal traces[1]['RemoteHost'], '
|
133
|
+
assert_equal traces[1]['RemoteHost'], '127.0.0.1'
|
132
134
|
assert_equal traces[1]['RemoteProtocol'], 'HTTP'
|
133
135
|
assert_equal traces[1]['ServiceArg'], '/'
|
134
136
|
assert_equal traces[1]['Pipeline'], 'true'
|
@@ -141,7 +143,7 @@ class ExconTest < Minitest::Test
|
|
141
143
|
|
142
144
|
begin
|
143
145
|
Oboe::API.start_trace('excon_tests') do
|
144
|
-
|
146
|
+
Excon.get('http://asfjalkfjlajfljkaljf/')
|
145
147
|
end
|
146
148
|
rescue
|
147
149
|
end
|
@@ -149,6 +151,7 @@ class ExconTest < Minitest::Test
|
|
149
151
|
traces = get_all_traces
|
150
152
|
assert_equal traces.count, 5
|
151
153
|
validate_outer_layers(traces, "excon_tests")
|
154
|
+
valid_edges?(traces)
|
152
155
|
|
153
156
|
assert_equal traces[1]['IsService'], 1
|
154
157
|
assert_equal traces[1]['RemoteHost'], 'asfjalkfjlajfljkaljf'
|
@@ -166,5 +169,39 @@ class ExconTest < Minitest::Test
|
|
166
169
|
assert_equal traces[3]['Layer'], 'excon'
|
167
170
|
assert_equal traces[3]['Label'], 'exit'
|
168
171
|
end
|
172
|
+
|
173
|
+
def test_obey_log_args_when_false
|
174
|
+
@log_args = Oboe::Config[:excon][:log_args]
|
175
|
+
clear_all_traces
|
176
|
+
|
177
|
+
Oboe::Config[:excon][:log_args] = false
|
178
|
+
|
179
|
+
Oboe::API.start_trace('excon_tests') do
|
180
|
+
Excon.get('http://127.0.0.1:8101/?blah=1')
|
181
|
+
end
|
182
|
+
|
183
|
+
traces = get_all_traces
|
184
|
+
assert_equal traces.count, 7
|
185
|
+
assert_equal traces[1]['ServiceArg'], '/'
|
186
|
+
|
187
|
+
Oboe::Config[:excon][:log_args] = @log_args
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_obey_log_args_when_true
|
191
|
+
@log_args = Oboe::Config[:excon][:log_args]
|
192
|
+
clear_all_traces
|
193
|
+
|
194
|
+
Oboe::Config[:excon][:log_args] = true
|
195
|
+
|
196
|
+
Oboe::API.start_trace('excon_tests') do
|
197
|
+
Excon.get('http://127.0.0.1:8101/?blah=1')
|
198
|
+
end
|
199
|
+
|
200
|
+
traces = get_all_traces
|
201
|
+
assert_equal traces.count, 7
|
202
|
+
assert_equal traces[1]['ServiceArg'], '/?blah=1'
|
203
|
+
|
204
|
+
Oboe::Config[:excon][:log_args] = @log_args
|
205
|
+
end
|
169
206
|
end
|
170
207
|
|
@@ -20,9 +20,9 @@ describe Oboe::Inst::FaradayConnection do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
it "should trace
|
23
|
+
it "should trace cross-app request" do
|
24
24
|
Oboe::API.start_trace('faraday_test') do
|
25
|
-
conn = Faraday.new(:url => 'http://
|
25
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
26
26
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
27
27
|
end
|
28
28
|
response = conn.get '/games?q=1'
|
@@ -30,38 +30,38 @@ describe Oboe::Inst::FaradayConnection do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
traces = get_all_traces
|
33
|
-
traces.count.must_equal
|
33
|
+
traces.count.must_equal 11
|
34
34
|
|
35
35
|
validate_outer_layers(traces, 'faraday_test')
|
36
36
|
|
37
37
|
traces[1]['Layer'].must_equal 'faraday'
|
38
38
|
traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
|
39
39
|
|
40
|
-
traces[
|
41
|
-
traces[
|
42
|
-
traces[
|
43
|
-
traces[
|
44
|
-
traces[
|
45
|
-
traces[
|
46
|
-
traces[
|
40
|
+
traces[6]['Layer'].must_equal 'net-http'
|
41
|
+
traces[6]['IsService'].must_equal 1
|
42
|
+
traces[6]['RemoteProtocol'].must_equal 'HTTP'
|
43
|
+
traces[6]['RemoteHost'].must_equal '127.0.0.1:8101'
|
44
|
+
traces[6]['ServiceArg'].must_equal '/games?q=1'
|
45
|
+
traces[6]['HTTPMethod'].must_equal 'GET'
|
46
|
+
traces[6]['HTTPStatus'].must_equal '200'
|
47
47
|
|
48
|
-
traces[
|
49
|
-
traces[
|
48
|
+
traces[7]['Layer'].must_equal 'net-http'
|
49
|
+
traces[7]['Label'].must_equal 'exit'
|
50
50
|
|
51
|
-
traces[
|
52
|
-
traces[
|
51
|
+
traces[8]['Layer'].must_equal 'faraday'
|
52
|
+
traces[9]['Label'].must_equal 'exit'
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should trace a Faraday request' do
|
56
56
|
Oboe::API.start_trace('faraday_test') do
|
57
|
-
conn = Faraday.new(:url => 'http://
|
57
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
58
58
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
59
59
|
end
|
60
|
-
|
60
|
+
conn.get '/?q=ruby_test_suite'
|
61
61
|
end
|
62
62
|
|
63
63
|
traces = get_all_traces
|
64
|
-
traces.count.must_equal
|
64
|
+
traces.count.must_equal 11
|
65
65
|
|
66
66
|
valid_edges?(traces)
|
67
67
|
validate_outer_layers(traces, 'faraday_test')
|
@@ -69,31 +69,32 @@ describe Oboe::Inst::FaradayConnection do
|
|
69
69
|
traces[1]['Layer'].must_equal 'faraday'
|
70
70
|
traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
|
71
71
|
|
72
|
-
traces[
|
73
|
-
traces[
|
74
|
-
traces[
|
75
|
-
traces[
|
76
|
-
traces[
|
77
|
-
traces[
|
78
|
-
traces[
|
72
|
+
traces[6]['Layer'].must_equal 'net-http'
|
73
|
+
traces[6]['Label'].must_equal 'info'
|
74
|
+
traces[6]['IsService'].must_equal 1
|
75
|
+
traces[6]['RemoteProtocol'].must_equal 'HTTP'
|
76
|
+
traces[6]['RemoteHost'].must_equal '127.0.0.1:8101'
|
77
|
+
traces[6]['ServiceArg'].must_equal '/?q=ruby_test_suite'
|
78
|
+
traces[6]['HTTPMethod'].must_equal 'GET'
|
79
|
+
traces[6]['HTTPStatus'].must_equal '200'
|
79
80
|
|
80
|
-
traces[
|
81
|
-
traces[
|
81
|
+
traces[7]['Layer'].must_equal 'net-http'
|
82
|
+
traces[7]['Label'].must_equal 'exit'
|
82
83
|
|
83
|
-
traces[
|
84
|
-
traces[
|
84
|
+
traces[8]['Layer'].must_equal 'faraday'
|
85
|
+
traces[8]['Label'].must_equal 'info'
|
85
86
|
|
86
|
-
traces[
|
87
|
-
traces[
|
87
|
+
traces[9]['Layer'].must_equal 'faraday'
|
88
|
+
traces[9]['Label'].must_equal 'exit'
|
88
89
|
end
|
89
90
|
|
90
|
-
it 'should trace a Faraday
|
91
|
+
it 'should trace a Faraday class style request' do
|
91
92
|
Oboe::API.start_trace('faraday_test') do
|
92
|
-
Faraday.get('http://
|
93
|
+
Faraday.get('http://127.0.0.1:8101/', {:a => 1})
|
93
94
|
end
|
94
95
|
|
95
96
|
traces = get_all_traces
|
96
|
-
traces.count.must_equal
|
97
|
+
traces.count.must_equal 11
|
97
98
|
|
98
99
|
valid_edges?(traces)
|
99
100
|
validate_outer_layers(traces, 'faraday_test')
|
@@ -101,34 +102,35 @@ describe Oboe::Inst::FaradayConnection do
|
|
101
102
|
traces[1]['Layer'].must_equal 'faraday'
|
102
103
|
traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
|
103
104
|
|
104
|
-
traces[
|
105
|
-
traces[
|
106
|
-
traces[
|
107
|
-
traces[
|
108
|
-
traces[
|
109
|
-
traces[
|
110
|
-
traces[
|
105
|
+
traces[6]['Layer'].must_equal 'net-http'
|
106
|
+
traces[6]['Label'].must_equal 'info'
|
107
|
+
traces[6]['IsService'].must_equal 1
|
108
|
+
traces[6]['RemoteProtocol'].must_equal 'HTTP'
|
109
|
+
traces[6]['RemoteHost'].must_equal '127.0.0.1:8101'
|
110
|
+
traces[6]['ServiceArg'].must_equal '/?a=1'
|
111
|
+
traces[6]['HTTPMethod'].must_equal 'GET'
|
112
|
+
traces[6]['HTTPStatus'].must_equal '200'
|
111
113
|
|
112
|
-
traces[
|
113
|
-
traces[
|
114
|
+
traces[7]['Layer'].must_equal 'net-http'
|
115
|
+
traces[7]['Label'].must_equal 'exit'
|
114
116
|
|
115
|
-
traces[
|
116
|
-
traces[
|
117
|
+
traces[8]['Layer'].must_equal 'faraday'
|
118
|
+
traces[8]['Label'].must_equal 'info'
|
117
119
|
|
118
|
-
traces[
|
119
|
-
traces[
|
120
|
+
traces[9]['Layer'].must_equal 'faraday'
|
121
|
+
traces[9]['Label'].must_equal 'exit'
|
120
122
|
end
|
121
123
|
|
122
|
-
it 'should trace a Faraday with
|
124
|
+
it 'should trace a Faraday with the excon adapter' do
|
123
125
|
Oboe::API.start_trace('faraday_test') do
|
124
|
-
conn = Faraday.new(:url => 'http://
|
126
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
125
127
|
faraday.adapter :excon
|
126
128
|
end
|
127
|
-
|
129
|
+
conn.get '/?q=1'
|
128
130
|
end
|
129
131
|
|
130
132
|
traces = get_all_traces
|
131
|
-
traces.count.must_equal
|
133
|
+
traces.count.must_equal 10
|
132
134
|
|
133
135
|
valid_edges?(traces)
|
134
136
|
validate_outer_layers(traces, 'faraday_test')
|
@@ -140,34 +142,77 @@ describe Oboe::Inst::FaradayConnection do
|
|
140
142
|
traces[2]['Label'].must_equal 'entry'
|
141
143
|
traces[2]['IsService'].must_equal 1
|
142
144
|
traces[2]['RemoteProtocol'].must_equal 'HTTP'
|
143
|
-
traces[2]['RemoteHost'].must_equal '
|
145
|
+
traces[2]['RemoteHost'].must_equal '127.0.0.1'
|
144
146
|
traces[2]['ServiceArg'].must_equal '/?q=1'
|
145
147
|
traces[2]['HTTPMethod'].must_equal 'GET'
|
146
148
|
|
147
|
-
traces[
|
148
|
-
traces[
|
149
|
-
traces[
|
149
|
+
traces[6]['Layer'].must_equal 'excon'
|
150
|
+
traces[6]['Label'].must_equal 'exit'
|
151
|
+
traces[6]['HTTPStatus'].must_equal 200
|
152
|
+
|
153
|
+
traces[7]['Layer'].must_equal 'faraday'
|
154
|
+
traces[7]['Label'].must_equal 'info'
|
155
|
+
unless RUBY_VERSION < '1.9.3'
|
156
|
+
# FIXME: Ruby 1.8 is reporting an object instance instead of
|
157
|
+
# an array
|
158
|
+
traces[7]['Middleware'].must_equal '[Faraday::Adapter::Excon]'
|
159
|
+
end
|
160
|
+
|
161
|
+
traces[8]['Layer'].must_equal 'faraday'
|
162
|
+
traces[8]['Label'].must_equal 'exit'
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'should trace a Faraday with the httpclient adapter' do
|
166
|
+
skip "FIXME: once HTTPClient instrumentation is done"
|
167
|
+
|
168
|
+
Oboe::API.start_trace('faraday_test') do
|
169
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
170
|
+
faraday.adapter :httpclient
|
171
|
+
end
|
172
|
+
conn.get '/?q=1'
|
173
|
+
end
|
174
|
+
|
175
|
+
traces = get_all_traces
|
176
|
+
traces.count.must_equal 10
|
177
|
+
|
178
|
+
valid_edges?(traces)
|
179
|
+
validate_outer_layers(traces, 'faraday_test')
|
180
|
+
|
181
|
+
traces[1]['Layer'].must_equal 'faraday'
|
182
|
+
traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
|
183
|
+
|
184
|
+
traces[2]['Layer'].must_equal 'excon'
|
185
|
+
traces[2]['Label'].must_equal 'entry'
|
186
|
+
traces[2]['IsService'].must_equal 1
|
187
|
+
traces[2]['RemoteProtocol'].must_equal 'HTTP'
|
188
|
+
traces[2]['RemoteHost'].must_equal '127.0.0.1'
|
189
|
+
traces[2]['ServiceArg'].must_equal '/?q=1'
|
190
|
+
traces[2]['HTTPMethod'].must_equal 'GET'
|
191
|
+
|
192
|
+
traces[6]['Layer'].must_equal 'excon'
|
193
|
+
traces[6]['Label'].must_equal 'exit'
|
194
|
+
traces[6]['HTTPStatus'].must_equal 200
|
150
195
|
|
151
|
-
traces[
|
152
|
-
traces[
|
196
|
+
traces[7]['Layer'].must_equal 'faraday'
|
197
|
+
traces[7]['Label'].must_equal 'info'
|
153
198
|
unless RUBY_VERSION < '1.9.3'
|
154
199
|
# FIXME: Ruby 1.8 is reporting an object instance instead of
|
155
200
|
# an array
|
156
|
-
traces[
|
201
|
+
traces[7]['Middleware'].must_equal '[Faraday::Adapter::Excon]'
|
157
202
|
end
|
158
203
|
|
159
|
-
traces[
|
160
|
-
traces[
|
204
|
+
traces[8]['Layer'].must_equal 'faraday'
|
205
|
+
traces[8]['Label'].must_equal 'exit'
|
161
206
|
end
|
162
207
|
|
163
208
|
it 'should obey :collect_backtraces setting when true' do
|
164
209
|
Oboe::Config[:faraday][:collect_backtraces] = true
|
165
210
|
|
166
211
|
Oboe::API.start_trace('faraday_test') do
|
167
|
-
conn = Faraday.new(:url => 'http://
|
212
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
168
213
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
169
214
|
end
|
170
|
-
|
215
|
+
conn.get '/?q=ruby_test_suite'
|
171
216
|
end
|
172
217
|
|
173
218
|
traces = get_all_traces
|
@@ -178,10 +223,10 @@ describe Oboe::Inst::FaradayConnection do
|
|
178
223
|
Oboe::Config[:faraday][:collect_backtraces] = false
|
179
224
|
|
180
225
|
Oboe::API.start_trace('faraday_test') do
|
181
|
-
conn = Faraday.new(:url => 'http://
|
226
|
+
conn = Faraday.new(:url => 'http://127.0.0.1:8101') do |faraday|
|
182
227
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
183
228
|
end
|
184
|
-
|
229
|
+
conn.get '/?q=ruby_test_suite'
|
185
230
|
end
|
186
231
|
|
187
232
|
traces = get_all_traces
|