appoptics_apm 4.0.3 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile_test +6 -7
- data/README.md +3 -3
- data/Rakefile +3 -2
- data/appoptics_apm.gemspec +2 -2
- data/docker-compose.yml +0 -22
- data/ext/oboe_metal/extconf.rb +4 -0
- data/lib/appoptics_apm/config.rb +11 -6
- data/lib/appoptics_apm/version.rb +1 -1
- metadata +3 -202
- data/gemfiles/delayed_job.gemfile +0 -36
- data/gemfiles/frameworks.gemfile +0 -44
- data/gemfiles/instrumentation_mocked.gemfile +0 -29
- data/gemfiles/libraries.gemfile +0 -85
- data/gemfiles/noop.gemfile +0 -17
- data/gemfiles/rails23.gemfile +0 -39
- data/gemfiles/rails30.gemfile +0 -42
- data/gemfiles/rails31.gemfile +0 -44
- data/gemfiles/rails32.gemfile +0 -54
- data/gemfiles/rails40.gemfile +0 -27
- data/gemfiles/rails41.gemfile +0 -27
- data/gemfiles/rails42.gemfile +0 -35
- data/gemfiles/rails50.gemfile +0 -44
- data/gemfiles/rails51.gemfile +0 -44
- data/test/benchmark/README.md +0 -65
- data/test/benchmark/logging_bench.rb +0 -54
- data/test/benchmark/with_libraries_gemfile/bunny_bench.rb +0 -69
- data/test/benchmark/with_rails5x_gemfile/action_controller5x_bench.rb +0 -43
- data/test/frameworks/apps/grape_nested.rb +0 -33
- data/test/frameworks/apps/grape_simple.rb +0 -80
- data/test/frameworks/apps/padrino_simple.rb +0 -80
- data/test/frameworks/apps/sinatra_simple.rb +0 -55
- data/test/frameworks/grape_test.rb +0 -286
- data/test/frameworks/padrino_test.rb +0 -222
- data/test/frameworks/rails3x_test.rb +0 -554
- data/test/frameworks/rails4x_test.rb +0 -570
- data/test/frameworks/rails5x_api_test.rb +0 -210
- data/test/frameworks/rails5x_test.rb +0 -376
- data/test/frameworks/rails_shared_tests.rb +0 -172
- data/test/frameworks/sinatra_test.rb +0 -140
- data/test/instrumentation/bunny_client_test.rb +0 -276
- data/test/instrumentation/bunny_consumer_test.rb +0 -204
- data/test/instrumentation/curb_test.rb +0 -398
- data/test/instrumentation/dalli_test.rb +0 -177
- data/test/instrumentation/em_http_request_test.rb +0 -89
- data/test/instrumentation/excon_test.rb +0 -231
- data/test/instrumentation/faraday_test.rb +0 -228
- data/test/instrumentation/http_test.rb +0 -143
- data/test/instrumentation/httpclient_test.rb +0 -304
- data/test/instrumentation/memcache_test.rb +0 -260
- data/test/instrumentation/memcached_test.rb +0 -229
- data/test/instrumentation/mongo_v1_test.rb +0 -479
- data/test/instrumentation/mongo_v2_index_test.rb +0 -124
- data/test/instrumentation/mongo_v2_test.rb +0 -584
- data/test/instrumentation/mongo_v2_view_test.rb +0 -435
- data/test/instrumentation/moped_test.rb +0 -517
- data/test/instrumentation/rack_test.rb +0 -165
- data/test/instrumentation/redis_hashes_test.rb +0 -268
- data/test/instrumentation/redis_keys_test.rb +0 -321
- data/test/instrumentation/redis_lists_test.rb +0 -310
- data/test/instrumentation/redis_misc_test.rb +0 -163
- data/test/instrumentation/redis_sets_test.rb +0 -296
- data/test/instrumentation/redis_sortedsets_test.rb +0 -328
- data/test/instrumentation/redis_strings_test.rb +0 -349
- data/test/instrumentation/resque_test.rb +0 -185
- data/test/instrumentation/rest-client_test.rb +0 -288
- data/test/instrumentation/sequel_mysql2_test.rb +0 -353
- data/test/instrumentation/sequel_mysql_test.rb +0 -334
- data/test/instrumentation/sequel_pg_test.rb +0 -336
- data/test/instrumentation/sidekiq-client_test.rb +0 -159
- data/test/instrumentation/sidekiq-worker_test.rb +0 -180
- data/test/instrumentation/twitter-cassandra_test.rb +0 -424
- data/test/instrumentation/typhoeus_test.rb +0 -284
- data/test/jobs/delayed_job/db_worker_job.rb +0 -29
- data/test/jobs/delayed_job/error_worker_job.rb +0 -10
- data/test/jobs/delayed_job/remote_call_worker_job.rb +0 -20
- data/test/jobs/resque/db_worker_job.rb +0 -29
- data/test/jobs/resque/error_worker_job.rb +0 -10
- data/test/jobs/resque/remote_call_worker_job.rb +0 -20
- data/test/jobs/sidekiq/db_worker_job.rb +0 -29
- data/test/jobs/sidekiq/error_worker_job.rb +0 -10
- data/test/jobs/sidekiq/remote_call_worker_job.rb +0 -20
- data/test/minitest_helper.rb +0 -277
- data/test/mocked/curb_mocked_test.rb +0 -324
- data/test/mocked/excon_mocked_test.rb +0 -174
- data/test/mocked/faraday_mocked_test.rb +0 -97
- data/test/mocked/http_mocked_test.rb +0 -135
- data/test/mocked/httpclient_mocked_test.rb +0 -258
- data/test/mocked/rest_client_mocked_test.rb +0 -109
- data/test/mocked/typhoeus_mocked_test.rb +0 -207
- data/test/models/widget.rb +0 -36
- data/test/noop/noop_test.rb +0 -145
- data/test/profiling/legacy_method_profiling_test.rb +0 -201
- data/test/profiling/method_profiling_test.rb +0 -631
- data/test/queues/delayed_job-client_test.rb +0 -95
- data/test/queues/delayed_job-worker_test.rb +0 -91
- data/test/reporter/reporter_test.rb +0 -14
- data/test/servers/delayed_job.rb +0 -107
- data/test/servers/rackapp_8101.rb +0 -29
- data/test/servers/rails3x_8140.rb +0 -96
- data/test/servers/rails4x_8140.rb +0 -96
- data/test/servers/rails5x_8140.rb +0 -95
- data/test/servers/rails5x_api_8150.rb +0 -78
- data/test/servers/sidekiq.rb +0 -29
- data/test/servers/sidekiq.yml +0 -7
- data/test/servers/sidekiq_initializer.rb +0 -25
- data/test/settings +0 -0
- data/test/support/auto_tracing_test.rb +0 -50
- data/test/support/backcompat_test.rb +0 -276
- data/test/support/config_test.rb +0 -149
- data/test/support/dnt_test.rb +0 -98
- data/test/support/init_report_test.rb +0 -25
- data/test/support/liboboe_settings_test.rb +0 -110
- data/test/support/logging_test.rb +0 -130
- data/test/support/sql_sanitize_test.rb +0 -55
- data/test/support/tracing_mode_test.rb +0 -33
- data/test/support/tvalias_test.rb +0 -15
- data/test/support/xtrace_test.rb +0 -41
@@ -1,55 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'sinatra'
|
5
|
-
|
6
|
-
class SinatraSimple < Sinatra::Base
|
7
|
-
set :reload, true
|
8
|
-
|
9
|
-
template :layout do
|
10
|
-
# Use both the legacy and new RUM helper
|
11
|
-
# oboe_rum_header + appoptics_rum_footer
|
12
|
-
# These should be no-op methods now.
|
13
|
-
%q{
|
14
|
-
<html>
|
15
|
-
<head></head>
|
16
|
-
<body>
|
17
|
-
<%= yield %>
|
18
|
-
</body>
|
19
|
-
</html>}
|
20
|
-
end
|
21
|
-
|
22
|
-
get "/" do
|
23
|
-
'The magick number is: 2767356926488785838763860464013972991031534522105386787489885890443740254365!' # Change only the number!!!
|
24
|
-
end
|
25
|
-
|
26
|
-
get "/rand" do
|
27
|
-
rand(2 ** 256).to_s
|
28
|
-
end
|
29
|
-
|
30
|
-
get "/render" do
|
31
|
-
render :erb, "This is an erb render"
|
32
|
-
end
|
33
|
-
|
34
|
-
get "/render/:id" do
|
35
|
-
render :erb, "The id is #{ params['id'] }"
|
36
|
-
end
|
37
|
-
|
38
|
-
get "/render/:id/what" do |id|
|
39
|
-
render :erb, "WOOT! The id is #{id} }"
|
40
|
-
end
|
41
|
-
|
42
|
-
get '/say/*/to/*' do
|
43
|
-
render :erb, "#{params['splat'][0]} #{params['splat'][1]}"
|
44
|
-
end
|
45
|
-
|
46
|
-
get /\/hello\/([\w]+)/ do
|
47
|
-
render :erb, "Hello, #{params['captures'].first}!"
|
48
|
-
end
|
49
|
-
|
50
|
-
get "/break" do
|
51
|
-
raise "This is a controller exception!"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
use SinatraSimple
|
@@ -1,286 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
require 'mocha/mini_test'
|
6
|
-
|
7
|
-
if RUBY_VERSION >= '1.9.3' and defined?(::Grape)
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/apps/grape_simple')
|
9
|
-
require File.expand_path(File.dirname(__FILE__) + '/apps/grape_nested')
|
10
|
-
|
11
|
-
describe Grape do
|
12
|
-
before do
|
13
|
-
clear_all_traces
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should trace a request to a simple grape stack" do
|
17
|
-
@app = GrapeSimple
|
18
|
-
|
19
|
-
r = get "/json_endpoint"
|
20
|
-
|
21
|
-
r.status.must_equal 200
|
22
|
-
r.headers.key?('X-Trace').must_equal true
|
23
|
-
|
24
|
-
traces = get_all_traces
|
25
|
-
traces.count.must_equal 5
|
26
|
-
|
27
|
-
validate_outer_layers(traces, 'rack')
|
28
|
-
|
29
|
-
traces[2]['Layer'].must_equal "grape"
|
30
|
-
traces[3]['Layer'].must_equal "grape"
|
31
|
-
traces[2].has_key?('Controller').must_equal true
|
32
|
-
traces[2].has_key?('Action').must_equal true
|
33
|
-
traces[4]['Label'].must_equal "exit"
|
34
|
-
|
35
|
-
# Validate the existence of the response header
|
36
|
-
r.headers.key?('X-Trace').must_equal true
|
37
|
-
r.headers['X-Trace'].must_equal traces[4]['X-Trace']
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should trace a request to a nested grape stack" do
|
41
|
-
@app = GrapeNested
|
42
|
-
|
43
|
-
r = get "/json_endpoint"
|
44
|
-
|
45
|
-
r.status.must_equal 200
|
46
|
-
r.headers.key?('X-Trace').must_equal true
|
47
|
-
|
48
|
-
traces = get_all_traces
|
49
|
-
traces.count.must_equal 5
|
50
|
-
|
51
|
-
validate_outer_layers(traces, 'rack')
|
52
|
-
|
53
|
-
traces[2]['Layer'].must_equal "grape"
|
54
|
-
traces[3]['Layer'].must_equal "grape"
|
55
|
-
traces[2].has_key?('Controller').must_equal true
|
56
|
-
traces[2].has_key?('Action').must_equal true
|
57
|
-
traces[4]['Label'].must_equal "exit"
|
58
|
-
|
59
|
-
# Validate the existence of the response header
|
60
|
-
r.headers.key?('X-Trace').must_equal true
|
61
|
-
r.headers['X-Trace'].must_equal traces[4]['X-Trace']
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should trace a an error in a nested grape stack" do
|
65
|
-
@app = GrapeNested
|
66
|
-
|
67
|
-
r = get "/error"
|
68
|
-
|
69
|
-
r.status.must_equal 500
|
70
|
-
r.headers.key?('X-Trace').must_equal true
|
71
|
-
|
72
|
-
traces = get_all_traces
|
73
|
-
traces.count.must_equal 6
|
74
|
-
|
75
|
-
validate_outer_layers(traces, 'rack')
|
76
|
-
|
77
|
-
traces[2]['Layer'].must_equal "grape"
|
78
|
-
traces[2]['Label'].must_equal "entry"
|
79
|
-
traces[3]['Layer'].must_equal "grape"
|
80
|
-
traces[3]['Label'].must_equal "exit"
|
81
|
-
traces[2].has_key?('Controller').must_equal true
|
82
|
-
traces[2].has_key?('Action').must_equal true
|
83
|
-
traces[4]['Label'].must_equal "error"
|
84
|
-
traces[4]['ErrorClass'].must_equal "GrapeError"
|
85
|
-
traces[4]['ErrorMsg'].must_equal "This is a error with 'error'!"
|
86
|
-
traces[4].has_key?('Backtrace').must_equal true
|
87
|
-
traces[5]['Layer'].must_equal "rack"
|
88
|
-
traces[5]['Label'].must_equal "exit"
|
89
|
-
|
90
|
-
# Validate the existence of the response header
|
91
|
-
r.headers.key?('X-Trace').must_equal true
|
92
|
-
r.headers['X-Trace'].must_equal traces[5]['X-Trace']
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
it "should trace a request with an exception" do
|
97
|
-
@app = GrapeSimple
|
98
|
-
|
99
|
-
begin
|
100
|
-
get "/break"
|
101
|
-
rescue Exception
|
102
|
-
# Do not handle/raise this error so
|
103
|
-
# we can continue to test
|
104
|
-
end
|
105
|
-
|
106
|
-
traces = get_all_traces
|
107
|
-
traces.count.must_equal 6
|
108
|
-
|
109
|
-
validate_outer_layers(traces, 'rack')
|
110
|
-
|
111
|
-
traces[2]['Layer'].must_equal "grape"
|
112
|
-
traces[3]['Layer'].must_equal "grape"
|
113
|
-
traces[2].has_key?('Controller').must_equal true
|
114
|
-
traces[2].has_key?('Action').must_equal true
|
115
|
-
traces[4]['Label'].must_equal "error"
|
116
|
-
traces[4]['ErrorClass'].must_equal "Exception"
|
117
|
-
traces[4]['ErrorMsg'].must_equal "This should have http status code 500!"
|
118
|
-
traces[5]['Label'].must_equal "exit"
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should trace a request with an error" do
|
122
|
-
@app = GrapeSimple
|
123
|
-
|
124
|
-
r = get "/error"
|
125
|
-
|
126
|
-
traces = get_all_traces
|
127
|
-
traces.count.must_equal 6
|
128
|
-
|
129
|
-
r.status.must_equal 500
|
130
|
-
r.headers.key?('X-Trace').must_equal true
|
131
|
-
|
132
|
-
validate_outer_layers(traces, 'rack')
|
133
|
-
|
134
|
-
traces[0]['Layer'].must_equal "rack"
|
135
|
-
traces[2]['Layer'].must_equal "grape"
|
136
|
-
traces[3]['Layer'].must_equal "grape"
|
137
|
-
traces[2].has_key?('Controller').must_equal true
|
138
|
-
traces[2].has_key?('Action').must_equal true
|
139
|
-
traces[4]['Label'].must_equal "error"
|
140
|
-
traces[4]['ErrorClass'].must_equal "GrapeError"
|
141
|
-
traces[4]['ErrorMsg'].must_equal "This is an error with 'error'!"
|
142
|
-
traces[5]['Layer'].must_equal "rack"
|
143
|
-
traces[5]['Label'].must_equal "exit"
|
144
|
-
traces[5]['Status'].must_equal 500
|
145
|
-
end
|
146
|
-
|
147
|
-
it "should report a simple GET path" do
|
148
|
-
@app = GrapeSimple
|
149
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
150
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
151
|
-
test_action = action
|
152
|
-
test_url = url
|
153
|
-
test_status = status
|
154
|
-
test_method = method
|
155
|
-
test_error = error
|
156
|
-
end.once
|
157
|
-
|
158
|
-
get "/employee_data"
|
159
|
-
|
160
|
-
assert_equal "GrapeSimple./employee_data", test_action
|
161
|
-
assert_equal "http://example.org/employee_data", test_url
|
162
|
-
assert_equal 200, test_status
|
163
|
-
assert_equal "GET", test_method
|
164
|
-
assert_equal 0, test_error
|
165
|
-
|
166
|
-
assert_controller_action(test_action)
|
167
|
-
end
|
168
|
-
|
169
|
-
it "should report a GET path with parameter" do
|
170
|
-
@app = GrapeSimple
|
171
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
172
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
173
|
-
test_action = action
|
174
|
-
test_url = url
|
175
|
-
test_status = status
|
176
|
-
test_method = method
|
177
|
-
test_error = error
|
178
|
-
end.once
|
179
|
-
|
180
|
-
get "/employee_data/12"
|
181
|
-
|
182
|
-
assert_equal "GrapeSimple./employee_data/:id", test_action
|
183
|
-
assert_equal "http://example.org/employee_data/12", test_url
|
184
|
-
assert_equal 200, test_status
|
185
|
-
assert_equal "GET", test_method
|
186
|
-
assert_equal 0, test_error
|
187
|
-
|
188
|
-
assert_controller_action(test_action)
|
189
|
-
end
|
190
|
-
|
191
|
-
it "should report a POST path" do
|
192
|
-
@app = GrapeSimple
|
193
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
194
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
195
|
-
test_action = action
|
196
|
-
test_url = url
|
197
|
-
test_status = status
|
198
|
-
test_method = method
|
199
|
-
test_error = error
|
200
|
-
end.once
|
201
|
-
|
202
|
-
data = {
|
203
|
-
:name => 'Tom',
|
204
|
-
:address => 'Street',
|
205
|
-
:age => 66
|
206
|
-
}
|
207
|
-
|
208
|
-
post '/employee_data', data
|
209
|
-
|
210
|
-
assert_equal "GrapeSimple./employee_data", test_action
|
211
|
-
assert_equal "http://example.org/employee_data", test_url
|
212
|
-
assert_equal 201, test_status
|
213
|
-
assert_equal "POST", test_method
|
214
|
-
assert_equal 0, test_error
|
215
|
-
|
216
|
-
assert_controller_action(test_action)
|
217
|
-
end
|
218
|
-
|
219
|
-
it "should report a PUT path" do
|
220
|
-
@app = GrapeSimple
|
221
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
222
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
223
|
-
test_action = action
|
224
|
-
test_url = url
|
225
|
-
test_status = status
|
226
|
-
test_method = method
|
227
|
-
test_error = error
|
228
|
-
end.once
|
229
|
-
|
230
|
-
put "/employee_data/12", { :address => 'Other Street' }
|
231
|
-
|
232
|
-
assert_equal "GrapeSimple./employee_data/:id", test_action
|
233
|
-
assert_equal "http://example.org/employee_data/12", test_url
|
234
|
-
assert_equal 200, test_status
|
235
|
-
assert_equal "PUT", test_method
|
236
|
-
assert_equal 0, test_error
|
237
|
-
|
238
|
-
assert_controller_action(test_action)
|
239
|
-
end
|
240
|
-
|
241
|
-
it "should report a DELETE path" do
|
242
|
-
@app = GrapeSimple
|
243
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
244
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
245
|
-
test_action = action
|
246
|
-
test_url = url
|
247
|
-
test_status = status
|
248
|
-
test_method = method
|
249
|
-
test_error = error
|
250
|
-
end.once
|
251
|
-
|
252
|
-
delete "/employee_data/12"
|
253
|
-
|
254
|
-
assert_equal "GrapeSimple./employee_data/:id", test_action
|
255
|
-
assert_equal "http://example.org/employee_data/12", test_url
|
256
|
-
assert_equal 200, test_status
|
257
|
-
assert_equal "DELETE", test_method
|
258
|
-
assert_equal 0, test_error
|
259
|
-
|
260
|
-
assert_controller_action(test_action)
|
261
|
-
end
|
262
|
-
|
263
|
-
it "should report a nested GET path with parameters" do
|
264
|
-
@app = GrapeSimple
|
265
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
266
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
267
|
-
test_action = action
|
268
|
-
test_url = url
|
269
|
-
test_status = status
|
270
|
-
test_method = method
|
271
|
-
test_error = error
|
272
|
-
end.once
|
273
|
-
|
274
|
-
get "/employee_data/12/nested/34"
|
275
|
-
|
276
|
-
assert_equal "GrapeSimple./employee_data/:id/nested/:child", test_action
|
277
|
-
assert_equal "http://example.org/employee_data/12/nested/34", test_url
|
278
|
-
assert_equal 200, test_status
|
279
|
-
assert_equal "GET", test_method
|
280
|
-
assert_equal 0, test_error
|
281
|
-
|
282
|
-
assert_controller_action(test_action)
|
283
|
-
end
|
284
|
-
|
285
|
-
end
|
286
|
-
end
|
@@ -1,222 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require "minitest_helper"
|
5
|
-
require "mocha/mini_test"
|
6
|
-
|
7
|
-
if RUBY_VERSION >= '1.9.3' and defined?(::Padrino)
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/apps/padrino_simple')
|
9
|
-
|
10
|
-
describe Padrino do
|
11
|
-
before do
|
12
|
-
clear_all_traces
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should trace a request to a simple padrino stack" do
|
16
|
-
@app = SimpleDemo
|
17
|
-
|
18
|
-
r = get "/render"
|
19
|
-
|
20
|
-
traces = get_all_traces
|
21
|
-
|
22
|
-
traces.count.must_equal 9
|
23
|
-
valid_edges?(traces).must_equal true
|
24
|
-
validate_outer_layers(traces, 'rack')
|
25
|
-
|
26
|
-
traces[2]['Layer'].must_equal "padrino"
|
27
|
-
traces[7]['Controller'].must_equal "SimpleDemo"
|
28
|
-
traces[8]['Label'].must_equal "exit"
|
29
|
-
|
30
|
-
# Validate the existence of the response header
|
31
|
-
r.headers.key?('X-Trace').must_equal true
|
32
|
-
r.headers['X-Trace'].must_equal traces[8]['X-Trace']
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should report controller.action" do
|
36
|
-
@app = SimpleDemo
|
37
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
38
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
39
|
-
test_action = action
|
40
|
-
test_url = url
|
41
|
-
test_status = status
|
42
|
-
test_method = method
|
43
|
-
test_error = error
|
44
|
-
end.once
|
45
|
-
|
46
|
-
get "/render"
|
47
|
-
|
48
|
-
assert_equal "SimpleDemo./render", test_action
|
49
|
-
assert_equal "http://example.org/render", test_url
|
50
|
-
assert_equal 200, test_status
|
51
|
-
assert_equal "GET", test_method
|
52
|
-
assert_equal 0, test_error
|
53
|
-
|
54
|
-
assert_controller_action(test_action)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should report controller.action for a symbol route" do
|
58
|
-
@app = SimpleDemo
|
59
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
60
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
61
|
-
test_action = action
|
62
|
-
test_url = url
|
63
|
-
test_status = status
|
64
|
-
test_method = method
|
65
|
-
test_error = error
|
66
|
-
end.once
|
67
|
-
|
68
|
-
get "/symbol_route"
|
69
|
-
|
70
|
-
assert_equal "SimpleDemo./symbol_route", test_action
|
71
|
-
assert_equal "http://example.org/symbol_route", test_url
|
72
|
-
assert_equal 200, test_status
|
73
|
-
assert_equal "GET", test_method
|
74
|
-
assert_equal 0, test_error
|
75
|
-
|
76
|
-
assert_controller_action(test_action)
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should report controller.action with :id" do
|
80
|
-
@app = SimpleDemo
|
81
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
82
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
83
|
-
test_action = action
|
84
|
-
test_url = url
|
85
|
-
test_status = status
|
86
|
-
test_method = method
|
87
|
-
test_error = error
|
88
|
-
end.once
|
89
|
-
|
90
|
-
r = get "/render/1234567890"
|
91
|
-
|
92
|
-
r.body.must_match /1234567890/
|
93
|
-
|
94
|
-
assert_equal "SimpleDemo./render/:id", test_action
|
95
|
-
assert_equal "http://example.org/render/1234567890", test_url
|
96
|
-
assert_equal 200, test_status
|
97
|
-
assert_equal "GET", test_method
|
98
|
-
assert_equal 0, test_error
|
99
|
-
|
100
|
-
assert_controller_action(test_action)
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should report controller.action for a symbol route with :id" do
|
104
|
-
@app = SimpleDemo
|
105
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
106
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
107
|
-
test_action = action
|
108
|
-
test_url = url
|
109
|
-
test_status = status
|
110
|
-
test_method = method
|
111
|
-
test_error = error
|
112
|
-
end.once
|
113
|
-
|
114
|
-
r = get "/symbol_route/1234567890"
|
115
|
-
|
116
|
-
r.body.must_match /1234567890/
|
117
|
-
|
118
|
-
assert_equal "SimpleDemo./symbol_route/:id", test_action
|
119
|
-
assert_equal "http://example.org/symbol_route/1234567890", test_url
|
120
|
-
assert_equal 200, test_status
|
121
|
-
assert_equal "GET", test_method
|
122
|
-
assert_equal 0, test_error
|
123
|
-
|
124
|
-
assert_controller_action(test_action)
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should report controller.action with :id and more" do
|
128
|
-
@app = SimpleDemo
|
129
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
130
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
131
|
-
test_action = action
|
132
|
-
test_url = url
|
133
|
-
test_status = status
|
134
|
-
test_method = method
|
135
|
-
test_error = error
|
136
|
-
end.once
|
137
|
-
|
138
|
-
r = get "/render/1234567890/what"
|
139
|
-
|
140
|
-
r.body.must_match /WOOT is 1234567890/
|
141
|
-
|
142
|
-
assert_equal "SimpleDemo./render/:id/what", test_action
|
143
|
-
assert_equal "http://example.org/render/1234567890/what", test_url
|
144
|
-
assert_equal 200, test_status
|
145
|
-
assert_equal "GET", test_method
|
146
|
-
assert_equal 0, test_error
|
147
|
-
|
148
|
-
assert_controller_action(test_action)
|
149
|
-
end
|
150
|
-
|
151
|
-
it "should report an error" do
|
152
|
-
@app = SimpleDemo
|
153
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
154
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
155
|
-
test_action = action
|
156
|
-
test_url = url
|
157
|
-
test_status = status
|
158
|
-
test_method = method
|
159
|
-
test_error = error
|
160
|
-
end.once
|
161
|
-
|
162
|
-
get "/error"
|
163
|
-
|
164
|
-
assert_equal "SimpleDemo./error", test_action
|
165
|
-
assert_equal "http://example.org/error", test_url
|
166
|
-
assert_equal 500, test_status
|
167
|
-
assert_equal "GET", test_method
|
168
|
-
assert_equal 1, test_error
|
169
|
-
|
170
|
-
assert_controller_action(test_action)
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should correctly report nested routes" do
|
174
|
-
@app = SimpleDemo
|
175
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
176
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
177
|
-
test_action = action
|
178
|
-
test_url = url
|
179
|
-
test_status = status
|
180
|
-
test_method = method
|
181
|
-
test_error = error
|
182
|
-
end.once
|
183
|
-
|
184
|
-
r = get "/user/12345/product"
|
185
|
-
|
186
|
-
r.body.must_match /12345/
|
187
|
-
|
188
|
-
assert_equal "product./user/:user_id/product", test_action
|
189
|
-
assert_equal "http://example.org/user/12345/product", test_url
|
190
|
-
assert_equal 200, test_status
|
191
|
-
assert_equal "GET", test_method
|
192
|
-
assert_equal 0, test_error
|
193
|
-
|
194
|
-
assert_controller_action(test_action)
|
195
|
-
end
|
196
|
-
|
197
|
-
it "should correctly report nested routes with param" do
|
198
|
-
@app = SimpleDemo
|
199
|
-
test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
|
200
|
-
AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
|
201
|
-
test_action = action
|
202
|
-
test_url = url
|
203
|
-
test_status = status
|
204
|
-
test_method = method
|
205
|
-
test_error = error
|
206
|
-
end.once
|
207
|
-
|
208
|
-
r = get "/user/12345/product/show/101010"
|
209
|
-
|
210
|
-
r.body.must_match /12345/
|
211
|
-
r.body.must_match /101010/
|
212
|
-
|
213
|
-
assert_equal "product./user/:user_id/product/show/:id", test_action
|
214
|
-
assert_equal "http://example.org/user/12345/product/show/101010", test_url
|
215
|
-
assert_equal 200, test_status
|
216
|
-
assert_equal "GET", test_method
|
217
|
-
assert_equal 0, test_error
|
218
|
-
|
219
|
-
assert_controller_action(test_action)
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|