appoptics_apm 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +43 -0
- data/.dockerignore +5 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +82 -0
- data/CHANGELOG.md +769 -0
- data/CONFIG.md +33 -0
- data/Dockerfile +41 -0
- data/Dockerfile_test +66 -0
- data/Gemfile +41 -0
- data/LICENSE +193 -0
- data/README.md +351 -0
- data/Rakefile +202 -0
- data/Vagrantfile +67 -0
- data/appoptics_apm.gemspec +55 -0
- data/build_gems.sh +15 -0
- data/docker-compose.yml +73 -0
- data/examples/DNT.md +35 -0
- data/examples/carrying_context.rb +220 -0
- data/examples/instrumenting_metal_controller.rb +8 -0
- data/examples/puma_on_heroku_config.rb +17 -0
- data/examples/tracing_async_threads.rb +124 -0
- data/examples/tracing_background_jobs.rb +53 -0
- data/examples/tracing_forked_processes.rb +99 -0
- data/examples/unicorn_on_heroku_config.rb +28 -0
- data/ext/oboe_metal/extconf.rb +54 -0
- data/ext/oboe_metal/lib/.keep +0 -0
- data/ext/oboe_metal/lib/liboboe-1.0.so.0.0.0 +0 -0
- data/ext/oboe_metal/noop/noop.c +7 -0
- data/ext/oboe_metal/src/VERSION +1 -0
- data/ext/oboe_metal/src/bson/bson.h +221 -0
- data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
- data/ext/oboe_metal/src/oboe.h +883 -0
- data/ext/oboe_metal/src/oboe.hpp +793 -0
- data/ext/oboe_metal/src/oboe_debug.h +50 -0
- data/ext/oboe_metal/src/oboe_wrap.cxx +6088 -0
- data/ext/oboe_metal/tests/test.rb +11 -0
- data/gemfiles/delayed_job.gemfile +36 -0
- data/gemfiles/frameworks.gemfile +44 -0
- data/gemfiles/instrumentation_mocked.gemfile +29 -0
- data/gemfiles/libraries.gemfile +85 -0
- data/gemfiles/rails23.gemfile +39 -0
- data/gemfiles/rails30.gemfile +42 -0
- data/gemfiles/rails31.gemfile +44 -0
- data/gemfiles/rails32.gemfile +54 -0
- data/gemfiles/rails40.gemfile +27 -0
- data/gemfiles/rails41.gemfile +27 -0
- data/gemfiles/rails42.gemfile +35 -0
- data/gemfiles/rails50.gemfile +44 -0
- data/gemfiles/rails51.gemfile +44 -0
- data/get_version.rb +5 -0
- data/init.rb +4 -0
- data/lib/appoptics_apm/api/layerinit.rb +39 -0
- data/lib/appoptics_apm/api/logging.rb +359 -0
- data/lib/appoptics_apm/api/memcache.rb +34 -0
- data/lib/appoptics_apm/api/profiling.rb +201 -0
- data/lib/appoptics_apm/api/tracing.rb +152 -0
- data/lib/appoptics_apm/api/util.rb +128 -0
- data/lib/appoptics_apm/api.rb +18 -0
- data/lib/appoptics_apm/base.rb +252 -0
- data/lib/appoptics_apm/config.rb +281 -0
- data/lib/appoptics_apm/frameworks/grape.rb +93 -0
- data/lib/appoptics_apm/frameworks/padrino/templates.rb +58 -0
- data/lib/appoptics_apm/frameworks/padrino.rb +52 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller.rb +106 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller2.rb +61 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb +58 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb +48 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller5.rb +50 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb +50 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_view.rb +58 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_view_2x.rb +56 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_view_30.rb +50 -0
- data/lib/appoptics_apm/frameworks/rails/inst/active_record.rb +27 -0
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +28 -0
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +30 -0
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils.rb +120 -0
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +101 -0
- data/lib/appoptics_apm/frameworks/rails.rb +116 -0
- data/lib/appoptics_apm/frameworks/sinatra/templates.rb +56 -0
- data/lib/appoptics_apm/frameworks/sinatra.rb +71 -0
- data/lib/appoptics_apm/inst/bunny-client.rb +148 -0
- data/lib/appoptics_apm/inst/bunny-consumer.rb +92 -0
- data/lib/appoptics_apm/inst/curb.rb +329 -0
- data/lib/appoptics_apm/inst/dalli.rb +85 -0
- data/lib/appoptics_apm/inst/delayed_job.rb +92 -0
- data/lib/appoptics_apm/inst/em-http-request.rb +105 -0
- data/lib/appoptics_apm/inst/excon.rb +130 -0
- data/lib/appoptics_apm/inst/faraday.rb +77 -0
- data/lib/appoptics_apm/inst/http.rb +83 -0
- data/lib/appoptics_apm/inst/httpclient.rb +176 -0
- data/lib/appoptics_apm/inst/memcache.rb +102 -0
- data/lib/appoptics_apm/inst/memcached.rb +94 -0
- data/lib/appoptics_apm/inst/mongo.rb +242 -0
- data/lib/appoptics_apm/inst/mongo2.rb +225 -0
- data/lib/appoptics_apm/inst/moped.rb +466 -0
- data/lib/appoptics_apm/inst/rack.rb +146 -0
- data/lib/appoptics_apm/inst/redis.rb +275 -0
- data/lib/appoptics_apm/inst/resque.rb +151 -0
- data/lib/appoptics_apm/inst/rest-client.rb +50 -0
- data/lib/appoptics_apm/inst/sequel.rb +178 -0
- data/lib/appoptics_apm/inst/sidekiq-client.rb +53 -0
- data/lib/appoptics_apm/inst/sidekiq-worker.rb +67 -0
- data/lib/appoptics_apm/inst/twitter-cassandra.rb +294 -0
- data/lib/appoptics_apm/inst/typhoeus.rb +113 -0
- data/lib/appoptics_apm/instrumentation.rb +22 -0
- data/lib/appoptics_apm/legacy_method_profiling.rb +97 -0
- data/lib/appoptics_apm/loading.rb +66 -0
- data/lib/appoptics_apm/logger.rb +41 -0
- data/lib/appoptics_apm/method_profiling.rb +33 -0
- data/lib/appoptics_apm/ruby.rb +35 -0
- data/lib/appoptics_apm/support.rb +135 -0
- data/lib/appoptics_apm/test.rb +94 -0
- data/lib/appoptics_apm/thread_local.rb +26 -0
- data/lib/appoptics_apm/util.rb +312 -0
- data/lib/appoptics_apm/version.rb +15 -0
- data/lib/appoptics_apm/xtrace.rb +103 -0
- data/lib/appoptics_apm.rb +72 -0
- data/lib/joboe_metal.rb +214 -0
- data/lib/oboe/README +2 -0
- data/lib/oboe/backward_compatibility.rb +80 -0
- data/lib/oboe/inst/rack.rb +11 -0
- data/lib/oboe.rb +7 -0
- data/lib/oboe_metal.rb +187 -0
- data/lib/rails/generators/appoptics_apm/install_generator.rb +45 -0
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +222 -0
- data/ruby_setup.sh +47 -0
- data/run_docker_build_gem_upload_to_packagecloud.sh +20 -0
- data/run_tests_docker.rb +32 -0
- data/test/benchmark/README.md +65 -0
- data/test/benchmark/logging_bench.rb +54 -0
- data/test/benchmark/with_libraries_gemfile/bunny_bench.rb +69 -0
- data/test/benchmark/with_rails5x_gemfile/action_controller5x_bench.rb +43 -0
- data/test/frameworks/apps/grape_nested.rb +33 -0
- data/test/frameworks/apps/grape_simple.rb +80 -0
- data/test/frameworks/apps/padrino_simple.rb +80 -0
- data/test/frameworks/apps/sinatra_simple.rb +55 -0
- data/test/frameworks/grape_test.rb +286 -0
- data/test/frameworks/padrino_test.rb +222 -0
- data/test/frameworks/rails3x_test.rb +554 -0
- data/test/frameworks/rails4x_test.rb +570 -0
- data/test/frameworks/rails5x_api_test.rb +210 -0
- data/test/frameworks/rails5x_test.rb +376 -0
- data/test/frameworks/rails_shared_tests.rb +172 -0
- data/test/frameworks/sinatra_test.rb +140 -0
- data/test/instrumentation/bunny_client_test.rb +276 -0
- data/test/instrumentation/bunny_consumer_test.rb +204 -0
- data/test/instrumentation/curb_test.rb +398 -0
- data/test/instrumentation/dalli_test.rb +177 -0
- data/test/instrumentation/em_http_request_test.rb +89 -0
- data/test/instrumentation/excon_test.rb +231 -0
- data/test/instrumentation/faraday_test.rb +228 -0
- data/test/instrumentation/http_test.rb +143 -0
- data/test/instrumentation/httpclient_test.rb +320 -0
- data/test/instrumentation/memcache_test.rb +260 -0
- data/test/instrumentation/memcached_test.rb +229 -0
- data/test/instrumentation/mongo_v1_test.rb +479 -0
- data/test/instrumentation/mongo_v2_index_test.rb +124 -0
- data/test/instrumentation/mongo_v2_test.rb +584 -0
- data/test/instrumentation/mongo_v2_view_test.rb +435 -0
- data/test/instrumentation/moped_test.rb +517 -0
- data/test/instrumentation/rack_test.rb +165 -0
- data/test/instrumentation/redis_hashes_test.rb +268 -0
- data/test/instrumentation/redis_keys_test.rb +321 -0
- data/test/instrumentation/redis_lists_test.rb +310 -0
- data/test/instrumentation/redis_misc_test.rb +163 -0
- data/test/instrumentation/redis_sets_test.rb +296 -0
- data/test/instrumentation/redis_sortedsets_test.rb +328 -0
- data/test/instrumentation/redis_strings_test.rb +349 -0
- data/test/instrumentation/resque_test.rb +185 -0
- data/test/instrumentation/rest-client_test.rb +288 -0
- data/test/instrumentation/sequel_mysql2_test.rb +353 -0
- data/test/instrumentation/sequel_mysql_test.rb +334 -0
- data/test/instrumentation/sequel_pg_test.rb +336 -0
- data/test/instrumentation/sidekiq-client_test.rb +159 -0
- data/test/instrumentation/sidekiq-worker_test.rb +180 -0
- data/test/instrumentation/twitter-cassandra_test.rb +424 -0
- data/test/instrumentation/typhoeus_test.rb +284 -0
- data/test/jobs/delayed_job/db_worker_job.rb +29 -0
- data/test/jobs/delayed_job/error_worker_job.rb +10 -0
- data/test/jobs/delayed_job/remote_call_worker_job.rb +20 -0
- data/test/jobs/resque/db_worker_job.rb +29 -0
- data/test/jobs/resque/error_worker_job.rb +10 -0
- data/test/jobs/resque/remote_call_worker_job.rb +20 -0
- data/test/jobs/sidekiq/db_worker_job.rb +29 -0
- data/test/jobs/sidekiq/error_worker_job.rb +10 -0
- data/test/jobs/sidekiq/remote_call_worker_job.rb +20 -0
- data/test/minitest_helper.rb +276 -0
- data/test/mocked/curb_mocked_test.rb +311 -0
- data/test/mocked/excon_mocked_test.rb +166 -0
- data/test/mocked/faraday_mocked_test.rb +93 -0
- data/test/mocked/http_mocked_test.rb +129 -0
- data/test/mocked/httpclient_mocked_test.rb +245 -0
- data/test/mocked/rest_client_mocked_test.rb +103 -0
- data/test/mocked/typhoeus_mocked_test.rb +192 -0
- data/test/models/widget.rb +36 -0
- data/test/profiling/legacy_method_profiling_test.rb +201 -0
- data/test/profiling/method_profiling_test.rb +631 -0
- data/test/queues/delayed_job-client_test.rb +95 -0
- data/test/queues/delayed_job-worker_test.rb +91 -0
- data/test/reporter/reporter_test.rb +14 -0
- data/test/servers/delayed_job.rb +107 -0
- data/test/servers/rackapp_8101.rb +29 -0
- data/test/servers/rails3x_8140.rb +96 -0
- data/test/servers/rails4x_8140.rb +96 -0
- data/test/servers/rails5x_8140.rb +95 -0
- data/test/servers/rails5x_api_8150.rb +78 -0
- data/test/servers/sidekiq.rb +29 -0
- data/test/servers/sidekiq.yml +7 -0
- data/test/servers/sidekiq_initializer.rb +25 -0
- data/test/settings +0 -0
- data/test/support/auto_tracing_test.rb +50 -0
- data/test/support/backcompat_test.rb +276 -0
- data/test/support/config_test.rb +149 -0
- data/test/support/dnt_test.rb +98 -0
- data/test/support/init_report_test.rb +25 -0
- data/test/support/liboboe_settings_test.rb +110 -0
- data/test/support/logging_test.rb +130 -0
- data/test/support/noop_test.rb +88 -0
- data/test/support/sql_sanitize_test.rb +55 -0
- data/test/support/tracing_mode_test.rb +33 -0
- data/test/support/tvalias_test.rb +15 -0
- data/test/support/xtrace_test.rb +41 -0
- metadata +475 -0
@@ -0,0 +1,284 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require 'minitest_helper'
|
5
|
+
require 'rack'
|
6
|
+
|
7
|
+
describe "Typhoeus" do
|
8
|
+
before do
|
9
|
+
clear_all_traces
|
10
|
+
@collect_backtraces = AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
11
|
+
@log_args = AppOpticsAPM::Config[:typhoeus][:log_args]
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
AppOpticsAPM::Config[:typhoeus][:collect_backtraces] = @collect_backtraces
|
16
|
+
AppOpticsAPM::Config[:typhoeus][:log_args] = @log_args
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'Typhoeus should be defined and ready' do
|
20
|
+
defined?(::Typhoeus::Request::Operations).wont_match nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'Typhoeus should have appoptics_apm methods defined' do
|
24
|
+
[ :run_with_appoptics ].each do |m|
|
25
|
+
::Typhoeus::Request::Operations.method_defined?(m).must_equal true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should trace a typhoeus request' do
|
30
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
31
|
+
Typhoeus.get("http://127.0.0.1:8101/")
|
32
|
+
end
|
33
|
+
|
34
|
+
traces = get_all_traces
|
35
|
+
traces.count.must_equal 8
|
36
|
+
|
37
|
+
valid_edges?(traces).must_equal true
|
38
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
39
|
+
|
40
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
41
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
42
|
+
|
43
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
44
|
+
traces[5]['Label'].must_equal 'info'
|
45
|
+
traces[5]['IsService'].must_equal 1
|
46
|
+
traces[5]['RemoteURL'].must_equal 'http://127.0.0.1:8101/'
|
47
|
+
traces[5]['HTTPMethod'].must_equal 'GET'
|
48
|
+
traces[5]['HTTPStatus'].must_equal 200
|
49
|
+
|
50
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
51
|
+
traces[6]['Label'].must_equal 'exit'
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should trace a typhoeus POST request' do
|
55
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
56
|
+
Typhoeus.post("127.0.0.1:8101/",
|
57
|
+
:body => { :key => "appoptics-ruby-fake", :content => "appoptics-ruby repo test suite"})
|
58
|
+
end
|
59
|
+
|
60
|
+
traces = get_all_traces
|
61
|
+
traces.count.must_equal 8
|
62
|
+
|
63
|
+
valid_edges?(traces).must_equal true
|
64
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
65
|
+
|
66
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
67
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
68
|
+
|
69
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
70
|
+
traces[5]['Label'].must_equal 'info'
|
71
|
+
traces[5]['IsService'].must_equal 1
|
72
|
+
traces[5]['RemoteURL'].casecmp('http://127.0.0.1:8101/').must_equal 0
|
73
|
+
traces[5]['HTTPMethod'].must_equal 'POST'
|
74
|
+
traces[5]['HTTPStatus'].must_equal 200
|
75
|
+
|
76
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
77
|
+
traces[6]['Label'].must_equal 'exit'
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should trace a typhoeus PUT request' do
|
81
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
82
|
+
Typhoeus.put("http://127.0.0.1:8101/",
|
83
|
+
:body => { :key => "appoptics-ruby-fake", :content => "appoptics-ruby repo test suite"})
|
84
|
+
end
|
85
|
+
|
86
|
+
traces = get_all_traces
|
87
|
+
traces.count.must_equal 8
|
88
|
+
|
89
|
+
valid_edges?(traces).must_equal true
|
90
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
91
|
+
|
92
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
93
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
94
|
+
|
95
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
96
|
+
traces[5]['Label'].must_equal 'info'
|
97
|
+
traces[5]['IsService'].must_equal 1
|
98
|
+
traces[5]['RemoteURL'].must_equal 'http://127.0.0.1:8101/'
|
99
|
+
traces[5]['HTTPMethod'].must_equal 'PUT'
|
100
|
+
traces[5]['HTTPStatus'].must_equal 200
|
101
|
+
|
102
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
103
|
+
traces[6]['Label'].must_equal 'exit'
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should trace a typhoeus DELETE request' do
|
107
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
108
|
+
Typhoeus.delete("http://127.0.0.1:8101/")
|
109
|
+
end
|
110
|
+
|
111
|
+
traces = get_all_traces
|
112
|
+
traces.count.must_equal 8
|
113
|
+
|
114
|
+
valid_edges?(traces).must_equal true
|
115
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
116
|
+
|
117
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
118
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
119
|
+
|
120
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
121
|
+
traces[5]['Label'].must_equal 'info'
|
122
|
+
traces[5]['IsService'].must_equal 1
|
123
|
+
traces[5]['RemoteURL'].must_equal 'http://127.0.0.1:8101/'
|
124
|
+
traces[5]['HTTPMethod'].must_equal 'DELETE'
|
125
|
+
traces[5]['HTTPStatus'].must_equal 200
|
126
|
+
|
127
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
128
|
+
traces[6]['Label'].must_equal 'exit'
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should trace a typhoeus HEAD request' do
|
132
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
133
|
+
Typhoeus.head("http://127.0.0.1:8101/")
|
134
|
+
end
|
135
|
+
|
136
|
+
traces = get_all_traces
|
137
|
+
traces.count.must_equal 8
|
138
|
+
|
139
|
+
valid_edges?(traces).must_equal true
|
140
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
141
|
+
|
142
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
143
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
144
|
+
|
145
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
146
|
+
traces[5]['Label'].must_equal 'info'
|
147
|
+
traces[5]['IsService'].must_equal 1
|
148
|
+
traces[5]['RemoteURL'].must_equal 'http://127.0.0.1:8101/'
|
149
|
+
traces[5]['HTTPMethod'].must_equal 'HEAD'
|
150
|
+
traces[5]['HTTPStatus'].must_equal 200
|
151
|
+
|
152
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
153
|
+
traces[6]['Label'].must_equal 'exit'
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'should trace a typhoeus GET request to an instr\'d app' do
|
157
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
158
|
+
Typhoeus.get("127.0.0.1:8101/")
|
159
|
+
end
|
160
|
+
|
161
|
+
traces = get_all_traces
|
162
|
+
traces.count.must_equal 8
|
163
|
+
|
164
|
+
valid_edges?(traces).must_equal true
|
165
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
166
|
+
|
167
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
168
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
169
|
+
|
170
|
+
traces[5]['Layer'].must_equal 'typhoeus'
|
171
|
+
traces[5]['Label'].must_equal 'info'
|
172
|
+
traces[5]['IsService'].must_equal 1
|
173
|
+
traces[5]['RemoteURL'].casecmp('http://127.0.0.1:8101/').must_equal 0
|
174
|
+
traces[5]['HTTPMethod'].must_equal 'GET'
|
175
|
+
traces[5]['HTTPStatus'].must_equal 200
|
176
|
+
|
177
|
+
traces[6]['Layer'].must_equal 'typhoeus'
|
178
|
+
traces[6]['Label'].must_equal 'exit'
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should trace a typhoeus GET request with DNS error' do
|
182
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
183
|
+
Typhoeus.get("thisdomaindoesntexisthopefully.asdf/products/appoptics_apm/")
|
184
|
+
end
|
185
|
+
|
186
|
+
traces = get_all_traces
|
187
|
+
traces.count.must_equal 6
|
188
|
+
|
189
|
+
valid_edges?(traces).must_equal true
|
190
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
191
|
+
|
192
|
+
traces[1]['Layer'].must_equal 'typhoeus'
|
193
|
+
traces[1].key?('Backtrace').must_equal AppOpticsAPM::Config[:typhoeus][:collect_backtraces]
|
194
|
+
|
195
|
+
traces[2]['Layer'].must_equal 'typhoeus'
|
196
|
+
traces[2]['Label'].must_equal 'error'
|
197
|
+
|
198
|
+
traces[3]['Layer'].must_equal 'typhoeus'
|
199
|
+
traces[3]['Label'].must_equal 'info'
|
200
|
+
traces[3]['IsService'].must_equal 1
|
201
|
+
traces[3]['RemoteURL'].casecmp('http://thisdomaindoesntexisthopefully.asdf/products/appoptics_apm/').must_equal 0
|
202
|
+
traces[3]['HTTPMethod'].must_equal 'GET'
|
203
|
+
traces[3]['HTTPStatus'].must_equal 0
|
204
|
+
|
205
|
+
traces[3]['Layer'].must_equal 'typhoeus'
|
206
|
+
traces[3]['Label'].must_equal 'info'
|
207
|
+
|
208
|
+
traces[4]['Layer'].must_equal 'typhoeus'
|
209
|
+
traces[4]['Label'].must_equal 'exit'
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should trace parallel typhoeus requests' do
|
213
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
214
|
+
hydra = Typhoeus::Hydra.hydra
|
215
|
+
|
216
|
+
first_request = Typhoeus::Request.new("127.0.0.1:8101/products/appoptics_apm/")
|
217
|
+
second_request = Typhoeus::Request.new("127.0.0.1:8101/products/")
|
218
|
+
third_request = Typhoeus::Request.new("127.0.0.1:8101/")
|
219
|
+
|
220
|
+
hydra.queue first_request
|
221
|
+
hydra.queue second_request
|
222
|
+
hydra.queue third_request
|
223
|
+
|
224
|
+
hydra.run
|
225
|
+
end
|
226
|
+
|
227
|
+
traces = get_all_traces
|
228
|
+
traces.count.must_equal 13
|
229
|
+
|
230
|
+
valid_edges?(traces).must_equal true
|
231
|
+
validate_outer_layers(traces, 'typhoeus_test')
|
232
|
+
|
233
|
+
traces[1]['Layer'].must_equal 'typhoeus_hydra'
|
234
|
+
traces[1]['Label'].must_equal 'entry'
|
235
|
+
traces[1]['Async'].must_equal 1
|
236
|
+
|
237
|
+
traces[11]['Layer'].must_equal 'typhoeus_hydra'
|
238
|
+
traces[11]['Label'].must_equal 'exit'
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'should obey :log_args setting when true' do
|
242
|
+
AppOpticsAPM::Config[:typhoeus][:log_args] = true
|
243
|
+
|
244
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
245
|
+
Typhoeus.get("127.0.0.1:8101/?blah=1")
|
246
|
+
end
|
247
|
+
|
248
|
+
traces = get_all_traces
|
249
|
+
traces[5]['RemoteURL'].casecmp('http://127.0.0.1:8101/?blah=1').must_equal 0
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'should obey :log_args setting when false' do
|
253
|
+
AppOpticsAPM::Config[:typhoeus][:log_args] = false
|
254
|
+
|
255
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
256
|
+
Typhoeus.get("127.0.0.1:8101/?blah=1")
|
257
|
+
end
|
258
|
+
|
259
|
+
traces = get_all_traces
|
260
|
+
traces[5]['RemoteURL'].casecmp('http://127.0.0.1:8101/').must_equal 0
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should obey :collect_backtraces setting when true' do
|
264
|
+
AppOpticsAPM::Config[:typhoeus][:collect_backtraces] = true
|
265
|
+
|
266
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
267
|
+
Typhoeus.get("127.0.0.1:8101/?blah=1")
|
268
|
+
end
|
269
|
+
|
270
|
+
traces = get_all_traces
|
271
|
+
layer_has_key(traces, 'typhoeus', 'Backtrace')
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should obey :collect_backtraces setting when false' do
|
275
|
+
AppOpticsAPM::Config[:typhoeus][:collect_backtraces] = false
|
276
|
+
|
277
|
+
AppOpticsAPM::API.start_trace('typhoeus_test') do
|
278
|
+
Typhoeus.get("127.0.0.1:8101/")
|
279
|
+
end
|
280
|
+
|
281
|
+
traces = get_all_traces
|
282
|
+
layer_doesnt_have_key(traces, 'typhoeus', 'Backtrace')
|
283
|
+
end
|
284
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class DJDBWorkerJob
|
5
|
+
@queue = :normal
|
6
|
+
|
7
|
+
def self.perform(*args)
|
8
|
+
return unless defined?(::Sequel) && !defined?(JRUBY_VERSION)
|
9
|
+
|
10
|
+
if ENV.key?('TRAVIS_MYSQL_PASS')
|
11
|
+
@db = Sequel.connect("mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test")
|
12
|
+
else
|
13
|
+
@db = Sequel.connect('mysql2://root@127.0.0.1:3306/travis_ci_test')
|
14
|
+
end
|
15
|
+
|
16
|
+
unless @db.table_exists?(:items)
|
17
|
+
@db.create_table :items do
|
18
|
+
primary_key :id
|
19
|
+
String :name
|
20
|
+
Float :price
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
@db.run('select 1')
|
25
|
+
|
26
|
+
items = @db[:items]
|
27
|
+
items.count
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class DJRemoteCallWorkerJob
|
5
|
+
@queue = :critical
|
6
|
+
|
7
|
+
def self.perform(*args)
|
8
|
+
# Make some random Dalli (memcache) calls and top it
|
9
|
+
# off with an excon call to the background rack webserver.
|
10
|
+
@dc = Dalli::Client.new
|
11
|
+
@dc.get(rand(10).to_s)
|
12
|
+
uri = URI('http://gameface.in/gamers')
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
15
|
+
http.request(request)
|
16
|
+
@dc.get(rand(10).to_s)
|
17
|
+
@dc.get(rand(10).to_s)
|
18
|
+
@dc.get_multi([:one, :two, :three, :four, :five, :six])
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class ResqueDBWorkerJob
|
5
|
+
@queue = :normal
|
6
|
+
|
7
|
+
def self.perform(*args)
|
8
|
+
return unless defined?(::Sequel) && !defined?(JRUBY_VERSION)
|
9
|
+
|
10
|
+
if ENV.key?('TRAVIS_MYSQL_PASS')
|
11
|
+
@db = Sequel.connect("mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test")
|
12
|
+
else
|
13
|
+
@db = Sequel.connect('mysql2://root@127.0.0.1:3306/travis_ci_test')
|
14
|
+
end
|
15
|
+
|
16
|
+
unless @db.table_exists?(:items)
|
17
|
+
@db.create_table :items do
|
18
|
+
primary_key :id
|
19
|
+
String :name
|
20
|
+
Float :price
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
@db.run('select 1')
|
25
|
+
|
26
|
+
items = @db[:items]
|
27
|
+
items.count
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class ResqueRemoteCallWorkerJob
|
5
|
+
@queue = :critical
|
6
|
+
|
7
|
+
def self.perform(*args)
|
8
|
+
# Make some random Dalli (memcache) calls and top it
|
9
|
+
# off with an excon call to the background rack webserver.
|
10
|
+
@dc = Dalli::Client.new
|
11
|
+
@dc.get(rand(10).to_s)
|
12
|
+
uri = URI('http://gameface.in/gamers')
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
15
|
+
http.request(request)
|
16
|
+
@dc.get(rand(10).to_s)
|
17
|
+
@dc.get(rand(10).to_s)
|
18
|
+
@dc.get_multi([:one, :two, :three, :four, :five, :six])
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class DBWorkerJob
|
5
|
+
include Sidekiq::Worker
|
6
|
+
|
7
|
+
def perform(*args)
|
8
|
+
return unless defined?(::Sequel) && !defined?(JRUBY_VERSION)
|
9
|
+
|
10
|
+
if ENV.key?('TRAVIS_MYSQL_PASS')
|
11
|
+
@db = Sequel.connect("mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test")
|
12
|
+
else
|
13
|
+
@db = Sequel.connect('mysql2://root@127.0.0.1:3306/travis_ci_test')
|
14
|
+
end
|
15
|
+
|
16
|
+
unless @db.table_exists?(:items)
|
17
|
+
@db.create_table :items do
|
18
|
+
primary_key :id
|
19
|
+
String :name
|
20
|
+
Float :price
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
@db.run('select 1')
|
25
|
+
|
26
|
+
items = @db[:items]
|
27
|
+
items.count
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
class RemoteCallWorkerJob
|
5
|
+
include Sidekiq::Worker
|
6
|
+
|
7
|
+
def perform(*args)
|
8
|
+
# Make some random Dalli (memcache) calls and top it
|
9
|
+
# off with an excon call to the background rack webserver.
|
10
|
+
@dc = Dalli::Client.new
|
11
|
+
@dc.get(rand(10).to_s)
|
12
|
+
uri = URI('http://gameface.in/gamers')
|
13
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
14
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
15
|
+
http.request(request)
|
16
|
+
@dc.get(rand(10).to_s)
|
17
|
+
@dc.get(rand(10).to_s)
|
18
|
+
@dc.get_multi([:one, :two, :three, :four, :five, :six])
|
19
|
+
end
|
20
|
+
end
|