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
data/test/support/config_test.rb
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
describe "AppOpticsAPM::Config" do
|
7
|
-
after do
|
8
|
-
# Set back to always trace mode
|
9
|
-
AppOpticsAPM::Config[:tracing_mode] = "always"
|
10
|
-
AppOpticsAPM::Config[:sample_rate] = 1000000
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should have the correct default values' do
|
14
|
-
# Reset AppOpticsAPM::Config to defaults
|
15
|
-
AppOpticsAPM::Config.initialize
|
16
|
-
|
17
|
-
# FIXME: We set the APPOPTICS_GEM_VERBOSE env for the
|
18
|
-
# ____ test suite so this assertion is not going to fly
|
19
|
-
#
|
20
|
-
# AppOpticsAPM::Config[:verbose].must_equal false
|
21
|
-
|
22
|
-
# TODO: Is there anything we should test here?
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should have the correct instrumentation defaults' do
|
26
|
-
# Reset AppOpticsAPM::Config to defaults
|
27
|
-
AppOpticsAPM::Config.initialize
|
28
|
-
|
29
|
-
instrumentation = AppOpticsAPM::Config.instrumentation
|
30
|
-
|
31
|
-
# Verify the number of individual instrumentations
|
32
|
-
instrumentation.count.must_equal 30
|
33
|
-
|
34
|
-
AppOpticsAPM::Config[:action_controller][:enabled].must_equal true
|
35
|
-
AppOpticsAPM::Config[:action_controller_api][:enabled].must_equal true
|
36
|
-
AppOpticsAPM::Config[:action_view][:enabled].must_equal true
|
37
|
-
AppOpticsAPM::Config[:active_record][:enabled].must_equal true
|
38
|
-
AppOpticsAPM::Config[:bunnyclient][:enabled].must_equal true
|
39
|
-
AppOpticsAPM::Config[:bunnyconsumer][:enabled].must_equal true
|
40
|
-
AppOpticsAPM::Config[:cassandra][:enabled].must_equal true
|
41
|
-
AppOpticsAPM::Config[:curb][:enabled].must_equal true
|
42
|
-
AppOpticsAPM::Config[:dalli][:enabled].must_equal true
|
43
|
-
AppOpticsAPM::Config[:delayed_jobclient][:enabled].must_equal true
|
44
|
-
AppOpticsAPM::Config[:delayed_jobworker][:enabled].must_equal true
|
45
|
-
AppOpticsAPM::Config[:em_http_request][:enabled].must_equal false
|
46
|
-
AppOpticsAPM::Config[:excon][:enabled].must_equal true
|
47
|
-
AppOpticsAPM::Config[:faraday][:enabled].must_equal true
|
48
|
-
AppOpticsAPM::Config[:grape][:enabled].must_equal true
|
49
|
-
AppOpticsAPM::Config[:httpclient][:enabled].must_equal true
|
50
|
-
AppOpticsAPM::Config[:nethttp][:enabled].must_equal true
|
51
|
-
AppOpticsAPM::Config[:memcached][:enabled].must_equal true
|
52
|
-
AppOpticsAPM::Config[:memcache][:enabled].must_equal true
|
53
|
-
AppOpticsAPM::Config[:mongo][:enabled].must_equal true
|
54
|
-
AppOpticsAPM::Config[:moped][:enabled].must_equal true
|
55
|
-
AppOpticsAPM::Config[:rack][:enabled].must_equal true
|
56
|
-
AppOpticsAPM::Config[:redis][:enabled].must_equal true
|
57
|
-
AppOpticsAPM::Config[:resqueclient][:enabled].must_equal true
|
58
|
-
AppOpticsAPM::Config[:resqueworker][:enabled].must_equal true
|
59
|
-
AppOpticsAPM::Config[:rest_client][:enabled].must_equal true
|
60
|
-
AppOpticsAPM::Config[:sequel][:enabled].must_equal true
|
61
|
-
AppOpticsAPM::Config[:sidekiqclient][:enabled].must_equal true
|
62
|
-
AppOpticsAPM::Config[:sidekiqworker][:enabled].must_equal true
|
63
|
-
AppOpticsAPM::Config[:typhoeus][:enabled].must_equal true
|
64
|
-
|
65
|
-
AppOpticsAPM::Config[:action_controller][:log_args].must_equal true
|
66
|
-
AppOpticsAPM::Config[:action_controller_api][:log_args].must_equal true
|
67
|
-
AppOpticsAPM::Config[:action_view][:log_args].must_equal true
|
68
|
-
AppOpticsAPM::Config[:active_record][:log_args].must_equal true
|
69
|
-
AppOpticsAPM::Config[:bunnyclient][:log_args].must_equal true
|
70
|
-
AppOpticsAPM::Config[:bunnyconsumer][:log_args].must_equal true
|
71
|
-
AppOpticsAPM::Config[:cassandra][:log_args].must_equal true
|
72
|
-
AppOpticsAPM::Config[:curb][:log_args].must_equal true
|
73
|
-
AppOpticsAPM::Config[:dalli][:log_args].must_equal true
|
74
|
-
AppOpticsAPM::Config[:delayed_jobclient][:log_args].must_equal true
|
75
|
-
AppOpticsAPM::Config[:delayed_jobworker][:log_args].must_equal true
|
76
|
-
AppOpticsAPM::Config[:em_http_request][:log_args].must_equal true
|
77
|
-
AppOpticsAPM::Config[:excon][:log_args].must_equal true
|
78
|
-
AppOpticsAPM::Config[:faraday][:log_args].must_equal true
|
79
|
-
AppOpticsAPM::Config[:grape][:log_args].must_equal true
|
80
|
-
AppOpticsAPM::Config[:httpclient][:log_args].must_equal true
|
81
|
-
AppOpticsAPM::Config[:nethttp][:log_args].must_equal true
|
82
|
-
AppOpticsAPM::Config[:memcached][:log_args].must_equal true
|
83
|
-
AppOpticsAPM::Config[:memcache][:log_args].must_equal true
|
84
|
-
AppOpticsAPM::Config[:mongo][:log_args].must_equal true
|
85
|
-
AppOpticsAPM::Config[:moped][:log_args].must_equal true
|
86
|
-
AppOpticsAPM::Config[:rack][:log_args].must_equal true
|
87
|
-
AppOpticsAPM::Config[:redis][:log_args].must_equal true
|
88
|
-
AppOpticsAPM::Config[:resqueclient][:log_args].must_equal true
|
89
|
-
AppOpticsAPM::Config[:resqueworker][:log_args].must_equal true
|
90
|
-
AppOpticsAPM::Config[:rest_client][:log_args].must_equal true
|
91
|
-
AppOpticsAPM::Config[:sequel][:log_args].must_equal true
|
92
|
-
AppOpticsAPM::Config[:sidekiqclient][:log_args].must_equal true
|
93
|
-
AppOpticsAPM::Config[:sidekiqworker][:log_args].must_equal true
|
94
|
-
AppOpticsAPM::Config[:typhoeus][:log_args].must_equal true
|
95
|
-
|
96
|
-
AppOpticsAPM::Config[:blacklist].is_a?(Array).must_equal true
|
97
|
-
|
98
|
-
AppOpticsAPM::Config[:dnt_regexp].must_equal '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|otf|eot|ttf|woff|woff2|svg|less)(\?.+){0,1}$'
|
99
|
-
AppOpticsAPM::Config[:dnt_opts].must_equal Regexp::IGNORECASE
|
100
|
-
|
101
|
-
AppOpticsAPM::Config[:sanitize_sql].must_equal true
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_should_obey_globals
|
105
|
-
# Reset AppOpticsAPM::Config to defaults
|
106
|
-
AppOpticsAPM::Config.initialize
|
107
|
-
|
108
|
-
http_clients = AppOpticsAPM::Config.http_clients
|
109
|
-
|
110
|
-
# Restore these at the end
|
111
|
-
@url_query_params = AppOpticsAPM::Config[:include_url_query_params]
|
112
|
-
@remote_url_params = AppOpticsAPM::Config[:include_remote_url_params]
|
113
|
-
|
114
|
-
# After setting global options, the per instrumentation
|
115
|
-
# equivalents should follow suit.
|
116
|
-
|
117
|
-
#
|
118
|
-
# :include_remote_url_params
|
119
|
-
#
|
120
|
-
|
121
|
-
# Check defaults
|
122
|
-
AppOpticsAPM::Config[:include_remote_url_params].must_equal true
|
123
|
-
http_clients.each do |i|
|
124
|
-
AppOpticsAPM::Config[i][:log_args].must_equal true
|
125
|
-
end
|
126
|
-
|
127
|
-
# Check obedience
|
128
|
-
AppOpticsAPM::Config[:include_remote_url_params] = false
|
129
|
-
http_clients.each do |i|
|
130
|
-
AppOpticsAPM::Config[i][:log_args].must_equal false
|
131
|
-
end
|
132
|
-
|
133
|
-
#
|
134
|
-
# :include_url_query_params
|
135
|
-
#
|
136
|
-
|
137
|
-
# Check default
|
138
|
-
AppOpticsAPM::Config[:include_url_query_params].must_equal true
|
139
|
-
AppOpticsAPM::Config[:rack][:log_args].must_equal true
|
140
|
-
|
141
|
-
# Check obedience
|
142
|
-
AppOpticsAPM::Config[:include_url_query_params] = false
|
143
|
-
AppOpticsAPM::Config[:rack][:log_args].must_equal false
|
144
|
-
|
145
|
-
# Restore the previous values
|
146
|
-
AppOpticsAPM::Config[:include_url_query_params] = @url_query_params
|
147
|
-
AppOpticsAPM::Config[:include_remote_url_params] = @remote_url_params
|
148
|
-
end
|
149
|
-
end
|
data/test/support/dnt_test.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
require 'rack/test'
|
6
|
-
require 'rack/lobster'
|
7
|
-
require 'appoptics_apm/inst/rack'
|
8
|
-
|
9
|
-
class RackTestApp < Minitest::Test
|
10
|
-
include Rack::Test::Methods
|
11
|
-
|
12
|
-
def app
|
13
|
-
@app = Rack::Builder.new {
|
14
|
-
use Rack::CommonLogger
|
15
|
-
use Rack::ShowExceptions
|
16
|
-
use AppOpticsAPM::Rack
|
17
|
-
map "/lobster" do
|
18
|
-
use Rack::Lint
|
19
|
-
run Rack::Lobster.new
|
20
|
-
end
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_custom_do_not_trace
|
25
|
-
clear_all_traces
|
26
|
-
|
27
|
-
dnt_original = AppOpticsAPM::Config[:dnt_regexp]
|
28
|
-
AppOpticsAPM::Config[:dnt_regexp] = "lobster$"
|
29
|
-
|
30
|
-
get "/lobster"
|
31
|
-
|
32
|
-
traces = get_all_traces
|
33
|
-
assert traces.empty?
|
34
|
-
|
35
|
-
AppOpticsAPM::Config[:dnt_regexp] = dnt_original
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_do_not_trace_static_assets
|
39
|
-
clear_all_traces
|
40
|
-
|
41
|
-
get "/assets/static_asset.png"
|
42
|
-
|
43
|
-
traces = get_all_traces
|
44
|
-
assert traces.empty?
|
45
|
-
|
46
|
-
assert last_response.status == 404
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_do_not_trace_static_assets_with_param
|
50
|
-
clear_all_traces
|
51
|
-
|
52
|
-
get "/assets/static_asset.png?body=1"
|
53
|
-
|
54
|
-
traces = get_all_traces
|
55
|
-
assert traces.empty?
|
56
|
-
|
57
|
-
assert last_response.status == 404
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_do_not_trace_static_assets_with_multiple_params
|
61
|
-
clear_all_traces
|
62
|
-
|
63
|
-
get "/assets/static_asset.png?body=1&head=0"
|
64
|
-
|
65
|
-
traces = get_all_traces
|
66
|
-
assert traces.empty?
|
67
|
-
|
68
|
-
assert last_response.status == 404
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_complex_do_not_trace
|
72
|
-
skip "not supported" if RUBY_VERSION < '1.9'
|
73
|
-
|
74
|
-
clear_all_traces
|
75
|
-
|
76
|
-
dnt_original = AppOpticsAPM::Config[:dnt_regexp]
|
77
|
-
|
78
|
-
# Do not trace .js files _except for_ show.js
|
79
|
-
AppOpticsAPM::Config[:dnt_regexp] = "(\.js$)(?<!show.js)"
|
80
|
-
|
81
|
-
# First: We shouldn't trace general .js files
|
82
|
-
get "/javascripts/application.js"
|
83
|
-
|
84
|
-
traces = get_all_traces
|
85
|
-
assert traces.empty?
|
86
|
-
|
87
|
-
# Second: We should trace show.js
|
88
|
-
clear_all_traces
|
89
|
-
|
90
|
-
get "/javascripts/show.js"
|
91
|
-
|
92
|
-
traces = get_all_traces
|
93
|
-
assert !traces.empty?
|
94
|
-
|
95
|
-
AppOpticsAPM::Config[:dnt_regexp] = dnt_original
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
class InitReportTest < Minitest::Test
|
7
|
-
def test_report_format
|
8
|
-
init_kvs = ::AppOpticsAPM::Util.build_init_report
|
9
|
-
init_kvs.is_a?(Hash)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_report_kvs
|
13
|
-
init_kvs = ::AppOpticsAPM::Util.build_init_report
|
14
|
-
init_kvs.has_key?("__Init").must_equal true
|
15
|
-
init_kvs.has_key?("Force").must_equal true
|
16
|
-
init_kvs.has_key?("Ruby.AppContainer.Version").must_equal true
|
17
|
-
init_kvs["Ruby.AppOpticsAPM.Version"].must_equal AppOpticsAPM::Version::STRING
|
18
|
-
init_kvs["Ruby.TraceMode.Version"].must_equal AppOpticsAPM::Config[:tracing_mode]
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_legacy_report_format
|
22
|
-
init_kvs = ::AppOpticsAPM::Util.legacy_build_init_report
|
23
|
-
init_kvs.is_a?(Hash)
|
24
|
-
end
|
25
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'set'
|
5
|
-
require 'minitest_helper'
|
6
|
-
require 'rack/test'
|
7
|
-
require 'rack/lobster'
|
8
|
-
require 'appoptics_apm/inst/rack'
|
9
|
-
|
10
|
-
unless defined?(JRUBY_VERSION)
|
11
|
-
AppOpticsAPM::Config[:tracing_mode] = 'always'
|
12
|
-
AppOpticsAPM::Config[:sample_rate] = 1e6
|
13
|
-
|
14
|
-
class RackTestApp < Minitest::Test
|
15
|
-
include Rack::Test::Methods
|
16
|
-
|
17
|
-
def app
|
18
|
-
@app = Rack::Builder.new {
|
19
|
-
use Rack::CommonLogger
|
20
|
-
use Rack::ShowExceptions
|
21
|
-
use AppOpticsAPM::Rack
|
22
|
-
map "/lobster" do
|
23
|
-
use Rack::Lint
|
24
|
-
run Rack::Lobster.new
|
25
|
-
end
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_localset_sample_source
|
30
|
-
skip("FIXME: broken on travis only") if ENV['TRAVIS'] == "true"
|
31
|
-
|
32
|
-
# We make an initial call here which will force the appoptics_apm gem to retrieve
|
33
|
-
# the sample_rate and sample_source from liboboe (via sample? method)
|
34
|
-
get "/lobster"
|
35
|
-
|
36
|
-
clear_all_traces
|
37
|
-
|
38
|
-
get "/lobster"
|
39
|
-
|
40
|
-
traces = get_all_traces
|
41
|
-
traces.count.must_equal 3
|
42
|
-
|
43
|
-
validate_outer_layers(traces, 'rack')
|
44
|
-
|
45
|
-
kvs = {}
|
46
|
-
kvs["SampleRate"] = 1000000
|
47
|
-
kvs["SampleSource"] = OBOE_SAMPLE_RATE_SOURCE_FILE
|
48
|
-
validate_event_keys(traces[0], kvs)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Test logging of all Ruby datatypes against the SWIG wrapper
|
52
|
-
# of addInfo which only has four overloads.
|
53
|
-
def test_swig_datatypes_conversion
|
54
|
-
event = AppOpticsAPM::Context.createEvent
|
55
|
-
report_kvs = {}
|
56
|
-
|
57
|
-
# Array
|
58
|
-
report_kvs[:TestData] = [0, 1, 2, 5, 7.0]
|
59
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
60
|
-
|
61
|
-
# Class
|
62
|
-
report_kvs[:TestData] = AppOpticsAPM::Reporter
|
63
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
64
|
-
|
65
|
-
# FalseClass
|
66
|
-
report_kvs[:TestData] = false
|
67
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
68
|
-
|
69
|
-
# Fixnum
|
70
|
-
report_kvs[:TestData] = 1_873_293_293
|
71
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
72
|
-
|
73
|
-
# Float
|
74
|
-
report_kvs[:TestData] = 1.0001
|
75
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
76
|
-
|
77
|
-
# Hash
|
78
|
-
report_kvs[:TestData] = Hash.new
|
79
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
80
|
-
|
81
|
-
# Integer
|
82
|
-
report_kvs[:TestData] = 1
|
83
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
84
|
-
|
85
|
-
# Module
|
86
|
-
report_kvs[:TestData] = AppOpticsAPM
|
87
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
88
|
-
|
89
|
-
# NilClass
|
90
|
-
report_kvs[:TestData] = nil
|
91
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
92
|
-
|
93
|
-
# Set
|
94
|
-
report_kvs[:TestData] = Set.new(1..10)
|
95
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
96
|
-
|
97
|
-
# String
|
98
|
-
report_kvs[:TestData] = 'test value'
|
99
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
100
|
-
|
101
|
-
# Symbol
|
102
|
-
report_kvs[:TestData] = :TestValue
|
103
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
104
|
-
|
105
|
-
# TrueClass
|
106
|
-
report_kvs[:TestData] = true
|
107
|
-
AppOpticsAPM::API.log('test_layer', 'entry', report_kvs, event)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
# Copyright (c) 2017 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
require 'mocha/mini_test'
|
6
|
-
|
7
|
-
describe AppOpticsAPM::API::Logging do
|
8
|
-
describe "when there is no xtrace" do
|
9
|
-
before do
|
10
|
-
AppOpticsAPM::Context.clear
|
11
|
-
end
|
12
|
-
|
13
|
-
it "log should not log an event" do
|
14
|
-
AppOpticsAPM::API.expects(:log_event).never
|
15
|
-
AppOpticsAPM::API.log(:test, 'test_label')
|
16
|
-
end
|
17
|
-
|
18
|
-
it "log_exception should not log an event" do
|
19
|
-
AppOpticsAPM::API.expects(:log_event).never
|
20
|
-
AppOpticsAPM::API.log_exception(:test, StandardError.new('no worries - testing error'))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "log_end should not log an event" do
|
24
|
-
AppOpticsAPM::API.expects(:log_event).never
|
25
|
-
AppOpticsAPM::API.log_end(:test)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "log_entry should not log an event" do
|
29
|
-
AppOpticsAPM::API.expects(:log_event).never
|
30
|
-
AppOpticsAPM::API.log_entry(:test)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "log_info should not log an event" do
|
34
|
-
AppOpticsAPM::API.expects(:log_event).never
|
35
|
-
AppOpticsAPM::API.log_info(:test)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "log_exit should not log an event" do
|
39
|
-
AppOpticsAPM::API.expects(:log_event).never
|
40
|
-
AppOpticsAPM::API.log_exit(:test)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "log_multi_exit should not log an event" do
|
44
|
-
AppOpticsAPM::API.expects(:log_event).never
|
45
|
-
AppOpticsAPM::API.log_multi_exit(:test, [])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe "when we are not sampling" do
|
50
|
-
before do
|
51
|
-
AppOpticsAPM::Context.fromString('2BA462ADE6CFE479081764CC476AA983351DC51B1BCB3468DA6F06EEFA00')
|
52
|
-
end
|
53
|
-
|
54
|
-
it "log should not log an event" do
|
55
|
-
AppOpticsAPM::API.expects(:log_event).never
|
56
|
-
AppOpticsAPM::API.log(:test, 'test_label')
|
57
|
-
end
|
58
|
-
|
59
|
-
it "log_exception should not log an event" do
|
60
|
-
AppOpticsAPM::API.expects(:log_event).never
|
61
|
-
AppOpticsAPM::API.log_exception(:test, StandardError.new('no worries - testing error'))
|
62
|
-
end
|
63
|
-
|
64
|
-
it "log_end should not log an event" do
|
65
|
-
AppOpticsAPM::API.expects(:log_event).never
|
66
|
-
AppOpticsAPM::API.log_end(:test)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "log_entry should not log an event" do
|
70
|
-
AppOpticsAPM::API.expects(:log_event).never
|
71
|
-
AppOpticsAPM::API.log_entry(:test)
|
72
|
-
end
|
73
|
-
|
74
|
-
it "log_info should not log an event" do
|
75
|
-
AppOpticsAPM::API.expects(:log_event).never
|
76
|
-
AppOpticsAPM::API.log_info(:test)
|
77
|
-
end
|
78
|
-
|
79
|
-
it "log_exit should not log an event" do
|
80
|
-
AppOpticsAPM::API.expects(:log_event).never
|
81
|
-
AppOpticsAPM::API.log_exit(:test)
|
82
|
-
end
|
83
|
-
|
84
|
-
it "log_multi_exit should not log an event" do
|
85
|
-
AppOpticsAPM::API.expects(:log_event).never
|
86
|
-
AppOpticsAPM::API.log_multi_exit(:test, [])
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "when we are sampling" do
|
91
|
-
before do
|
92
|
-
AppOpticsAPM::Context.fromString('2BA462ADE6CFE479081764CC476AA983351DC51B1BCB3468DA6F06EEFA01')
|
93
|
-
end
|
94
|
-
|
95
|
-
it "log should log an event" do
|
96
|
-
AppOpticsAPM::API.expects(:log_event)
|
97
|
-
AppOpticsAPM::API.log(:test, 'test_label')
|
98
|
-
end
|
99
|
-
|
100
|
-
it "log_exception should log an event" do
|
101
|
-
AppOpticsAPM::API.expects(:log_event)
|
102
|
-
AppOpticsAPM::API.log_exception(:test, StandardError.new('no worries - testing error'))
|
103
|
-
end
|
104
|
-
|
105
|
-
it "log_end should log an event" do
|
106
|
-
AppOpticsAPM::API.expects(:log_event)
|
107
|
-
AppOpticsAPM::API.log_end(:test)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "log_entry should log an event" do
|
111
|
-
AppOpticsAPM::API.expects(:log_event)
|
112
|
-
AppOpticsAPM::API.log_entry(:test)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "log_info should log an event" do
|
116
|
-
AppOpticsAPM::API.expects(:log_event)
|
117
|
-
AppOpticsAPM::API.log_info(:test)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "log_exit should log an event" do
|
121
|
-
AppOpticsAPM::API.expects(:log_event)
|
122
|
-
AppOpticsAPM::API.log_exit(:test)
|
123
|
-
end
|
124
|
-
|
125
|
-
it "log_multi_exit should log an event" do
|
126
|
-
AppOpticsAPM::API.expects(:log_event)
|
127
|
-
AppOpticsAPM::API.log_multi_exit(:test, [])
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|