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,159 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
if RUBY_VERSION >= '2.0' && !defined?(JRUBY_VERSION)
|
5
|
-
require 'minitest_helper'
|
6
|
-
require 'sidekiq'
|
7
|
-
require_relative "../jobs/sidekiq/remote_call_worker_job"
|
8
|
-
require_relative "../jobs/sidekiq/db_worker_job"
|
9
|
-
require_relative "../jobs/sidekiq/error_worker_job"
|
10
|
-
|
11
|
-
class SidekiqClientTest < Minitest::Test
|
12
|
-
def setup
|
13
|
-
clear_all_traces
|
14
|
-
AppOpticsAPM::Context.clear
|
15
|
-
@collect_backtraces = AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces]
|
16
|
-
@log_args = AppOpticsAPM::Config[:sidekiqclient][:log_args]
|
17
|
-
@tracing_mode = AppOpticsAPM::Config[:tracing_mode]
|
18
|
-
end
|
19
|
-
|
20
|
-
def teardown
|
21
|
-
AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces] = @collect_backtraces
|
22
|
-
AppOpticsAPM::Config[:sidekiqclient][:log_args] = @log_args
|
23
|
-
AppOpticsAPM::Config[:tracing_mode] = @tracing_mode
|
24
|
-
end
|
25
|
-
|
26
|
-
def refined_trace_count(traces)
|
27
|
-
# we expect 23 traces, but it looks like there are cases where an extra 2 or 4 redis traces slip in
|
28
|
-
# This method will allow the tests to pass despite the inconsistency in counts and also log some information
|
29
|
-
|
30
|
-
redis_traces = traces.select { |h| h['Layer'] == 'redis' }
|
31
|
-
traces.count - redis_traces.count
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_enqueue
|
35
|
-
# Queue up a job to be run
|
36
|
-
jid, _ = ::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
37
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Allow the job to be run
|
41
|
-
sleep 5
|
42
|
-
|
43
|
-
traces = get_all_traces
|
44
|
-
assert_equal 21, refined_trace_count(traces)
|
45
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
46
|
-
|
47
|
-
assert_equal 'sidekiq-client', traces[1]['Layer']
|
48
|
-
assert_equal 'entry', traces[1]['Label']
|
49
|
-
|
50
|
-
assert_equal 'pushq', traces[1]['Spec']
|
51
|
-
assert_equal 'sidekiq', traces[1]['Flavor']
|
52
|
-
assert_equal 'critical', traces[1]['Queue']
|
53
|
-
assert_equal jid, traces[1]['MsgID']
|
54
|
-
assert_equal '[1, 2, 3]', traces[1]['Args']
|
55
|
-
assert_equal "RemoteCallWorkerJob", traces[1]['JobName']
|
56
|
-
assert_equal 'false', traces[1]['Retry']
|
57
|
-
assert_equal false, traces[1].key?('Backtrace')
|
58
|
-
|
59
|
-
assert_equal 'sidekiq-client', traces[2]['Layer']
|
60
|
-
assert_equal 'exit', traces[2]['Label']
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_collect_backtraces_default_value
|
64
|
-
assert_equal AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces], false, "default backtrace collection"
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_log_args_default_value
|
68
|
-
assert_equal AppOpticsAPM::Config[:sidekiqclient][:log_args], true, "log_args default "
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_obey_collect_backtraces_when_false
|
72
|
-
AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces] = false
|
73
|
-
|
74
|
-
# Queue up a job to be run
|
75
|
-
::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
76
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Allow the job to be run
|
80
|
-
sleep 5
|
81
|
-
|
82
|
-
traces = get_all_traces
|
83
|
-
assert_equal 21, refined_trace_count(traces)
|
84
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
85
|
-
assert_equal 'sidekiq-client', traces[1]['Layer']
|
86
|
-
assert_equal false, traces[1].key?('Backtrace')
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_obey_collect_backtraces_when_true
|
90
|
-
AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces] = true
|
91
|
-
|
92
|
-
# Queue up a job to be run
|
93
|
-
::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
94
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
95
|
-
end
|
96
|
-
|
97
|
-
# Allow the job to be run
|
98
|
-
sleep 5
|
99
|
-
|
100
|
-
traces = get_all_traces
|
101
|
-
assert_equal 21, refined_trace_count(traces)
|
102
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
103
|
-
assert_equal 'sidekiq-client', traces[1]['Layer']
|
104
|
-
assert_equal true, traces[1].key?('Backtrace')
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_obey_log_args_when_false
|
108
|
-
AppOpticsAPM::Config[:sidekiqclient][:log_args] = false
|
109
|
-
|
110
|
-
# Queue up a job to be run
|
111
|
-
::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
112
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
113
|
-
end
|
114
|
-
|
115
|
-
# Allow the job to be run
|
116
|
-
sleep 5
|
117
|
-
|
118
|
-
traces = get_all_traces
|
119
|
-
assert_equal 21, refined_trace_count(traces)
|
120
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
121
|
-
assert_equal false, traces[1].key?('Args')
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_obey_log_args_when_true
|
125
|
-
AppOpticsAPM::Config[:sidekiqclient][:log_args] = true
|
126
|
-
|
127
|
-
# Queue up a job to be run
|
128
|
-
::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
129
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
130
|
-
end
|
131
|
-
|
132
|
-
# Allow the job to be run
|
133
|
-
sleep 5
|
134
|
-
|
135
|
-
traces = get_all_traces
|
136
|
-
assert_equal 21, refined_trace_count(traces)
|
137
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
138
|
-
assert_equal true, traces[1].key?('Args')
|
139
|
-
assert_equal '[1, 2, 3]', traces[1]['Args']
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_dont_log_when_not_sampling
|
143
|
-
AppOpticsAPM::Config[:sidekiqclient][:log_args] = true
|
144
|
-
AppOpticsAPM::Config[:tracing_mode] = 'never'
|
145
|
-
|
146
|
-
::AppOpticsAPM::API.start_trace(:enqueue_test) do
|
147
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
148
|
-
end
|
149
|
-
|
150
|
-
sleep 3
|
151
|
-
traces = get_all_traces
|
152
|
-
|
153
|
-
# FIXME: the sidekiq worker is not respecting the AppOpticsAPM::Config[:tracing_mode] = 'never' setting
|
154
|
-
# ____ instead of no traces we are getting 17, that is 4 less than we would get with tracing
|
155
|
-
# assert_equal 0, traces.count
|
156
|
-
assert_equal 17, refined_trace_count(traces)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
if RUBY_VERSION >= '2.0' && !defined?(JRUBY_VERSION)
|
5
|
-
require 'minitest_helper'
|
6
|
-
require 'sidekiq'
|
7
|
-
require_relative "../jobs/sidekiq/remote_call_worker_job"
|
8
|
-
require_relative "../jobs/sidekiq/db_worker_job"
|
9
|
-
require_relative "../jobs/sidekiq/error_worker_job"
|
10
|
-
|
11
|
-
class SidekiqWorkerTest < Minitest::Test
|
12
|
-
def setup
|
13
|
-
clear_all_traces
|
14
|
-
@collect_backtraces = AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces]
|
15
|
-
@log_args = AppOpticsAPM::Config[:sidekiqworker][:log_args]
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces] = @collect_backtraces
|
20
|
-
AppOpticsAPM::Config[:sidekiqworker][:log_args] = @log_args
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_reports_version_init
|
24
|
-
init_kvs = ::AppOpticsAPM::Util.build_init_report
|
25
|
-
assert init_kvs.key?('Ruby.sidekiq.Version')
|
26
|
-
assert_equal ::Sidekiq::VERSION, init_kvs['Ruby.sidekiq.Version']
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_job_run
|
30
|
-
# Queue up a job to be run
|
31
|
-
jid = Sidekiq::Client.push('queue' => 'critical', 'class' => RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
32
|
-
|
33
|
-
# Allow the job to be run
|
34
|
-
sleep 5
|
35
|
-
|
36
|
-
traces = get_all_traces
|
37
|
-
assert_equal 17, traces.count, "Trace count"
|
38
|
-
validate_outer_layers(traces, "sidekiq-worker")
|
39
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
40
|
-
|
41
|
-
# Validate entry layer KVs
|
42
|
-
assert_equal 'always_sampled', traces[0]['TraceOrigin'], "is always_sampled"
|
43
|
-
assert_equal true, traces[0].key?('SampleRate'), "has SampleRate KV"
|
44
|
-
assert_equal true, traces[0].key?('SampleSource'), "has SampleSource KV"
|
45
|
-
|
46
|
-
# Validate Webserver Spec KVs
|
47
|
-
assert_equal Socket.gethostname, traces[0]['HTTP-Host']
|
48
|
-
assert_equal "Sidekiq_critical", traces[0]['Controller']
|
49
|
-
assert_equal "RemoteCallWorkerJob", traces[0]['Action']
|
50
|
-
assert_equal "/sidekiq/critical/RemoteCallWorkerJob", traces[0]['URL']
|
51
|
-
|
52
|
-
# Validate Job Spec KVs
|
53
|
-
assert_equal "job", traces[0]['Spec']
|
54
|
-
assert_equal 'sidekiq', traces[0]['Flavor']
|
55
|
-
assert_equal "RemoteCallWorkerJob", traces[0]['JobName']
|
56
|
-
assert_equal jid, traces[0]['MsgID']
|
57
|
-
assert_equal "critical", traces[0]['Queue']
|
58
|
-
assert_equal "[1, 2, 3]", traces[0]['Args']
|
59
|
-
assert_equal "false", traces[0]['Retry']
|
60
|
-
|
61
|
-
assert_equal false, traces[0].key?('Backtrace')
|
62
|
-
assert_equal "net-http", traces[4]['Layer']
|
63
|
-
assert_equal "entry", traces[4]['Label']
|
64
|
-
assert_equal "memcache", traces[15]['Layer']
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_jobs_with_errors
|
68
|
-
# Queue up a job to be run
|
69
|
-
jid = Sidekiq::Client.push('queue' => 'critical', 'class' => ErrorWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
70
|
-
|
71
|
-
# Allow the job to be run
|
72
|
-
sleep 5
|
73
|
-
|
74
|
-
traces = get_all_traces
|
75
|
-
assert_equal 3, traces.count, "Trace count"
|
76
|
-
validate_outer_layers(traces, "sidekiq-worker")
|
77
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
78
|
-
|
79
|
-
# Validate Webserver Spec KVs
|
80
|
-
assert_equal Socket.gethostname, traces[0]['HTTP-Host']
|
81
|
-
assert_equal "Sidekiq_critical", traces[0]['Controller']
|
82
|
-
assert_equal "ErrorWorkerJob", traces[0]['Action']
|
83
|
-
assert_equal "/sidekiq/critical/ErrorWorkerJob", traces[0]['URL']
|
84
|
-
|
85
|
-
# Validate Job Spec KVs
|
86
|
-
assert_equal "job", traces[0]['Spec']
|
87
|
-
assert_equal 'sidekiq', traces[0]['Flavor']
|
88
|
-
assert_equal "ErrorWorkerJob", traces[0]['JobName']
|
89
|
-
assert_equal jid, traces[0]['MsgID']
|
90
|
-
assert_equal "critical", traces[0]['Queue']
|
91
|
-
assert_equal "[1, 2, 3]", traces[0]['Args']
|
92
|
-
assert_equal "false", traces[0]['Retry']
|
93
|
-
|
94
|
-
assert_equal traces[1]['Layer'], 'sidekiq-worker'
|
95
|
-
assert_equal traces[1]['Label'], 'error'
|
96
|
-
assert_equal traces[1]['ErrorClass'], "RuntimeError"
|
97
|
-
assert traces[1].key?('ErrorMsg')
|
98
|
-
assert traces[1].key?('Backtrace')
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_collect_backtraces_default_value
|
102
|
-
assert_equal AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces], false, "default backtrace collection"
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_log_args_default_value
|
106
|
-
assert_equal AppOpticsAPM::Config[:sidekiqworker][:log_args], true, "log_args default "
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_obey_collect_backtraces_when_false
|
110
|
-
AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces] = false
|
111
|
-
|
112
|
-
# Queue up a job to be run
|
113
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
114
|
-
|
115
|
-
# Allow the job to be run
|
116
|
-
sleep 5
|
117
|
-
|
118
|
-
traces = get_all_traces
|
119
|
-
assert_equal 17, traces.count, "Trace count"
|
120
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
121
|
-
assert_equal 'sidekiq-worker', traces[0]['Layer']
|
122
|
-
assert_equal false, traces[0].key?('Backtrace')
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_obey_collect_backtraces_when_true
|
126
|
-
# FIXME: This can't be tested with the current Sidekiq minitest integration (e.g. already booted
|
127
|
-
# sidekiq in a different process)
|
128
|
-
skip
|
129
|
-
|
130
|
-
AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces] = true
|
131
|
-
|
132
|
-
# Queue up a job to be run
|
133
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
134
|
-
|
135
|
-
# Allow the job to be run
|
136
|
-
sleep 5
|
137
|
-
|
138
|
-
traces = get_all_traces
|
139
|
-
assert_equal 17, traces.count, "Trace count"
|
140
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
141
|
-
assert_equal 'sidekiq-worker', traces[0]['Layer']
|
142
|
-
assert_equal true, traces[0].key?('Backtrace')
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_obey_log_args_when_false
|
146
|
-
# FIXME: This can't be tested with the current Sidekiq minitest integration (e.g. already booted
|
147
|
-
# sidekiq in a different process)
|
148
|
-
skip
|
149
|
-
|
150
|
-
AppOpticsAPM::Config[:sidekiqworker][:log_args] = false
|
151
|
-
|
152
|
-
# Queue up a job to be run
|
153
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
154
|
-
|
155
|
-
# Allow the job to be run
|
156
|
-
sleep 5
|
157
|
-
|
158
|
-
traces = get_all_traces
|
159
|
-
assert_equal 17, traces.count, "Trace count"
|
160
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
161
|
-
assert_equal false, traces[0].key?('Args')
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_obey_log_args_when_true
|
165
|
-
AppOpticsAPM::Config[:sidekiqworker][:log_args] = true
|
166
|
-
|
167
|
-
# Queue up a job to be run
|
168
|
-
Sidekiq::Client.push('queue' => 'critical', 'class' => ::RemoteCallWorkerJob, 'args' => [1, 2, 3], 'retry' => false)
|
169
|
-
|
170
|
-
# Allow the job to be run
|
171
|
-
sleep 5
|
172
|
-
|
173
|
-
traces = get_all_traces
|
174
|
-
assert_equal 17, traces.count, "Trace count"
|
175
|
-
assert valid_edges?(traces), "Invalid edge in traces"
|
176
|
-
assert_equal true, traces[0].key?('Args')
|
177
|
-
assert_equal '[1, 2, 3]', traces[0]['Args']
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
@@ -1,424 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
unless ENV['APPOPTICS_CASSANDRA_SERVER']
|
7
|
-
ENV['APPOPTICS_CASSANDRA_SERVER'] = "127.0.0.1:9160"
|
8
|
-
end
|
9
|
-
|
10
|
-
# The cassandra-rb client doesn't support JRuby
|
11
|
-
# https://github.com/cassandra-rb/cassandra
|
12
|
-
|
13
|
-
# exclude cassandra tests for now
|
14
|
-
# TODO: they need refactoring to use the 'cassandra-driver' gem instead of the 'cassandra' gem,
|
15
|
-
# ____ which hasn't had a commit since 09/2014
|
16
|
-
|
17
|
-
if defined?(::Cassandra) and !defined?(JRUBY_VERSION)
|
18
|
-
describe "Cassandra" do
|
19
|
-
before do
|
20
|
-
clear_all_traces
|
21
|
-
|
22
|
-
@client = Cassandra.new("system", ENV['APPOPTICS_CASSANDRA_SERVER'], { :timeout => 10 })
|
23
|
-
@client.disable_node_auto_discovery!
|
24
|
-
|
25
|
-
@ks_name = "AppNetaCassandraTest"
|
26
|
-
|
27
|
-
ks_def = CassandraThrift::KsDef.new(:name => @ks_name,
|
28
|
-
:strategy_class => "SimpleStrategy",
|
29
|
-
:strategy_options => { 'replication_factor' => '2' },
|
30
|
-
:cf_defs => [])
|
31
|
-
|
32
|
-
@client.add_keyspace(ks_def) unless @client.keyspaces.include? @ks_name
|
33
|
-
@client.keyspace = @ks_name
|
34
|
-
|
35
|
-
unless @client.column_families.include? "Users"
|
36
|
-
cf_def = CassandraThrift::CfDef.new(:keyspace => @ks_name, :name => "Users")
|
37
|
-
@client.add_column_family(cf_def)
|
38
|
-
end
|
39
|
-
|
40
|
-
unless @client.column_families.include? "Statuses"
|
41
|
-
cf_def = CassandraThrift::CfDef.new(:keyspace => @ks_name, :name => "Statuses")
|
42
|
-
@client.add_column_family(cf_def)
|
43
|
-
end
|
44
|
-
|
45
|
-
# These are standard entry/exit KVs that are passed up with all mongo operations
|
46
|
-
@entry_kvs = {
|
47
|
-
'Layer' => 'cassandra',
|
48
|
-
'Label' => 'entry',
|
49
|
-
'RemoteHost' => ENV['APPOPTICS_CASSANDRA_SERVER'].split(':')[0],
|
50
|
-
'RemotePort' => ENV['APPOPTICS_CASSANDRA_SERVER'].split(':')[1] }
|
51
|
-
|
52
|
-
@exit_kvs = { 'Layer' => 'cassandra', 'Label' => 'exit' }
|
53
|
-
@collect_backtraces = AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
54
|
-
end
|
55
|
-
|
56
|
-
after do
|
57
|
-
AppOpticsAPM::Config[:cassandra][:collect_backtraces] = @collect_backtraces
|
58
|
-
@client.disconnect!
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'Stock Cassandra should be loaded, defined and ready' do
|
62
|
-
defined?(::Cassandra).wont_match nil
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'Cassandra should have appoptics_apm methods defined' do
|
66
|
-
[ :insert, :remove, :count_columns, :get_columns, :multi_get_columns, :get,
|
67
|
-
:multi_get, :get_range_single, :get_range_batch, :get_indexed_slices,
|
68
|
-
:create_index, :drop_index, :add_column_family, :drop_column_family,
|
69
|
-
:add_keyspace, :drop_keyspace ].each do |m|
|
70
|
-
::Cassandra.method_defined?("#{m}_with_appoptics").must_equal true
|
71
|
-
end
|
72
|
-
# Special 'exists?' case
|
73
|
-
::Cassandra.method_defined?("exists_with_appoptics?").must_equal true
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'shouldn\'t break when NOT tracing' do
|
77
|
-
begin
|
78
|
-
user = {'screen_name' => 'larry', "blah" => "ok"}
|
79
|
-
@client.insert(:Users, '5', user, { :ttl => 600, :consistency => 1})
|
80
|
-
@client.remove(:Users, '5', 'blah')
|
81
|
-
@client.count_columns(:Statuses, '12', :count => 50)
|
82
|
-
@client.get_columns(:Statuses, '12', ['body'])
|
83
|
-
@client.multi_get_columns(:Users, ['12', '5'], ['body'])
|
84
|
-
@client.get(:Statuses, '12', :reversed => true)
|
85
|
-
@client.get_range_keys(:Statuses, :key_count => 4)
|
86
|
-
@client.create_index(@ks_name, 'Statuses', 'x', 'LongType')
|
87
|
-
expressions = [
|
88
|
-
{ :column_name => 'x',
|
89
|
-
:value => [0,20].pack("NN"),
|
90
|
-
:comparison => "=="},
|
91
|
-
{ :column_name => 'non_indexed',
|
92
|
-
:value => [5].pack("N*"),
|
93
|
-
:comparison => ">"} ]
|
94
|
-
@client.get_indexed_slices(:Statuses, expressions).length
|
95
|
-
@client.exists?(:Statuses, '12')
|
96
|
-
@client.exists?(:Statuses, '12', 'body')
|
97
|
-
@client.drop_index(@ks_name, 'Statuses', 'column_name')
|
98
|
-
@client.drop_keyspace(@ks_name)
|
99
|
-
rescue => e
|
100
|
-
# My crappy way to detect and fail if an exception
|
101
|
-
# was raised. I swear there was a Minitest assertion for
|
102
|
-
# this but can't find it.
|
103
|
-
e.must_be_nil 'broken when NOT tracing'
|
104
|
-
raise
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'should trace insert' do
|
109
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
110
|
-
user = {'screen_name' => 'larry', "blah" => "ok"}
|
111
|
-
@client.insert(:Users, '5', user, { :ttl => 600, :consistency => 1})
|
112
|
-
end
|
113
|
-
|
114
|
-
traces = get_all_traces
|
115
|
-
|
116
|
-
traces.count.must_equal 4
|
117
|
-
validate_outer_layers(traces, 'cassandra_test')
|
118
|
-
|
119
|
-
validate_event_keys(traces[1], @entry_kvs)
|
120
|
-
traces[1]['Op'].must_equal "insert"
|
121
|
-
traces[1]['Cf'].must_equal "Users"
|
122
|
-
traces[1]['Key'].must_equal "\"5\""
|
123
|
-
traces[1]['Consistency'].must_equal 1
|
124
|
-
traces[1]['Ttl'].must_equal 600
|
125
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
126
|
-
validate_event_keys(traces[2], @exit_kvs)
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'should trace remove' do
|
130
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
131
|
-
@client.remove(:Users, '5', 'blah')
|
132
|
-
end
|
133
|
-
|
134
|
-
traces = get_all_traces
|
135
|
-
|
136
|
-
traces.count.must_equal 4
|
137
|
-
validate_outer_layers(traces, 'cassandra_test')
|
138
|
-
|
139
|
-
validate_event_keys(traces[1], @entry_kvs)
|
140
|
-
traces[1]['Op'].must_equal "remove"
|
141
|
-
traces[1]['Cf'].must_equal "Users"
|
142
|
-
traces[1]['Key'].must_equal "\"5\""
|
143
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
144
|
-
validate_event_keys(traces[2], @exit_kvs)
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'should trace count_columns' do
|
148
|
-
@client.insert(:Statuses, '12', {'body' => 'v1', 'user' => 'v2'})
|
149
|
-
|
150
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
151
|
-
@client.count_columns(:Statuses, '12', :count => 50)
|
152
|
-
end
|
153
|
-
|
154
|
-
traces = get_all_traces
|
155
|
-
|
156
|
-
traces.count.must_equal 4
|
157
|
-
validate_outer_layers(traces, 'cassandra_test')
|
158
|
-
|
159
|
-
validate_event_keys(traces[1], @entry_kvs)
|
160
|
-
traces[1]['Op'].must_equal "count_columns"
|
161
|
-
traces[1]['Cf'].must_equal "Statuses"
|
162
|
-
traces[1]['Key'].must_equal "\"12\""
|
163
|
-
traces[1]['Count'].must_equal 50
|
164
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
165
|
-
validate_event_keys(traces[2], @exit_kvs)
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'should trace get_columns' do
|
169
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
170
|
-
@client.get_columns(:Statuses, '12', ['body'])
|
171
|
-
end
|
172
|
-
|
173
|
-
traces = get_all_traces
|
174
|
-
|
175
|
-
traces.count.must_equal 4
|
176
|
-
validate_outer_layers(traces, 'cassandra_test')
|
177
|
-
|
178
|
-
validate_event_keys(traces[1], @entry_kvs)
|
179
|
-
traces[1]['Op'].must_equal "get_columns"
|
180
|
-
traces[1]['Cf'].must_equal "Statuses"
|
181
|
-
traces[1]['Key'].must_equal "\"12\""
|
182
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
183
|
-
validate_event_keys(traces[2], @exit_kvs)
|
184
|
-
end
|
185
|
-
|
186
|
-
it 'should trace multi_get_columns' do
|
187
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
188
|
-
@client.multi_get_columns(:Users, ['12', '5'], ['body'])
|
189
|
-
end
|
190
|
-
|
191
|
-
traces = get_all_traces
|
192
|
-
|
193
|
-
traces.count.must_equal 4
|
194
|
-
validate_outer_layers(traces, 'cassandra_test')
|
195
|
-
|
196
|
-
validate_event_keys(traces[1], @entry_kvs)
|
197
|
-
traces[1]['Op'].must_equal "multi_get_columns"
|
198
|
-
traces[1]['Cf'].must_equal "Users"
|
199
|
-
traces[1]['Key'].must_equal "[\"12\", \"5\"]"
|
200
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
201
|
-
validate_event_keys(traces[2], @exit_kvs)
|
202
|
-
end
|
203
|
-
|
204
|
-
it 'should trace get' do
|
205
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
206
|
-
@client.get(:Statuses, '12', :reversed => true)
|
207
|
-
end
|
208
|
-
|
209
|
-
traces = get_all_traces
|
210
|
-
|
211
|
-
traces.count.must_equal 4
|
212
|
-
validate_outer_layers(traces, 'cassandra_test')
|
213
|
-
|
214
|
-
validate_event_keys(traces[1], @entry_kvs)
|
215
|
-
traces[1]['Op'].must_equal "get"
|
216
|
-
traces[1]['Cf'].must_equal "Statuses"
|
217
|
-
traces[1]['Key'].must_equal "\"12\""
|
218
|
-
traces[1]['Reversed'].must_equal "true"
|
219
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
220
|
-
validate_event_keys(traces[2], @exit_kvs)
|
221
|
-
end
|
222
|
-
|
223
|
-
it 'should trace exists?' do
|
224
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
225
|
-
@client.exists?(:Statuses, '12')
|
226
|
-
@client.exists?(:Statuses, '12', 'body')
|
227
|
-
end
|
228
|
-
|
229
|
-
traces = get_all_traces
|
230
|
-
|
231
|
-
traces.count.must_equal 6
|
232
|
-
validate_outer_layers(traces, 'cassandra_test')
|
233
|
-
|
234
|
-
validate_event_keys(traces[1], @entry_kvs)
|
235
|
-
traces[1]['Op'].must_equal "exists?"
|
236
|
-
traces[1]['Cf'].must_equal "Statuses"
|
237
|
-
traces[1]['Key'].must_equal "\"12\""
|
238
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
239
|
-
validate_event_keys(traces[2], @exit_kvs)
|
240
|
-
|
241
|
-
traces[3]['Op'].must_equal "exists?"
|
242
|
-
traces[3]['Cf'].must_equal "Statuses"
|
243
|
-
traces[3]['Key'].must_equal "\"12\""
|
244
|
-
traces[3].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'should trace get_range_keys' do
|
248
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
249
|
-
@client.get_range_keys(:Statuses, :key_count => 4)
|
250
|
-
end
|
251
|
-
|
252
|
-
traces = get_all_traces
|
253
|
-
|
254
|
-
traces.count.must_equal 4
|
255
|
-
validate_outer_layers(traces, 'cassandra_test')
|
256
|
-
|
257
|
-
validate_event_keys(traces[1], @entry_kvs)
|
258
|
-
traces[1]['Op'].must_equal "get_range_batch"
|
259
|
-
traces[1]['Cf'].must_equal "Statuses"
|
260
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
261
|
-
validate_event_keys(traces[2], @exit_kvs)
|
262
|
-
end
|
263
|
-
|
264
|
-
it 'should trace create_index' do
|
265
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
266
|
-
@client.create_index(@ks_name, 'Statuses', 'column_name', 'LongType')
|
267
|
-
end
|
268
|
-
|
269
|
-
traces = get_all_traces
|
270
|
-
|
271
|
-
traces.count.must_equal 4
|
272
|
-
validate_outer_layers(traces, 'cassandra_test')
|
273
|
-
|
274
|
-
validate_event_keys(traces[1], @entry_kvs)
|
275
|
-
traces[1]['Op'].must_equal "create_index"
|
276
|
-
traces[1]['Cf'].must_equal "Statuses"
|
277
|
-
traces[1]['Keyspace'].must_equal @ks_name
|
278
|
-
traces[1]['Column_name'].must_equal "column_name"
|
279
|
-
traces[1]['Validation_class'].must_equal "LongType"
|
280
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
281
|
-
validate_event_keys(traces[2], @exit_kvs)
|
282
|
-
|
283
|
-
# Clean up
|
284
|
-
@client.drop_index(@ks_name, 'Statuses', 'column_name')
|
285
|
-
end
|
286
|
-
|
287
|
-
it 'should trace drop_index' do
|
288
|
-
# Prep
|
289
|
-
@client.create_index(@ks_name, 'Statuses', 'column_name', 'LongType')
|
290
|
-
|
291
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
292
|
-
@client.drop_index(@ks_name, 'Statuses', 'column_name')
|
293
|
-
end
|
294
|
-
|
295
|
-
traces = get_all_traces
|
296
|
-
|
297
|
-
traces.count.must_equal 4
|
298
|
-
validate_outer_layers(traces, 'cassandra_test')
|
299
|
-
|
300
|
-
validate_event_keys(traces[1], @entry_kvs)
|
301
|
-
traces[1]['Op'].must_equal "drop_index"
|
302
|
-
traces[1]['Cf'].must_equal "Statuses"
|
303
|
-
traces[1]['Keyspace'].must_equal @ks_name
|
304
|
-
traces[1]['Column_name'].must_equal "column_name"
|
305
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
306
|
-
validate_event_keys(traces[2], @exit_kvs)
|
307
|
-
end
|
308
|
-
|
309
|
-
it 'should trace get_indexed_slices' do
|
310
|
-
@client.create_index(@ks_name, 'Statuses', 'x', 'LongType')
|
311
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
312
|
-
expressions = [
|
313
|
-
{ :column_name => 'x',
|
314
|
-
:value => [0,20].pack("NN"),
|
315
|
-
:comparison => "=="},
|
316
|
-
{ :column_name => 'non_indexed',
|
317
|
-
:value => [5].pack("N*"),
|
318
|
-
:comparison => ">"} ]
|
319
|
-
@client.get_indexed_slices(:Statuses, expressions).length
|
320
|
-
end
|
321
|
-
|
322
|
-
traces = get_all_traces
|
323
|
-
|
324
|
-
traces.count.must_equal 4
|
325
|
-
validate_outer_layers(traces, 'cassandra_test')
|
326
|
-
|
327
|
-
validate_event_keys(traces[1], @entry_kvs)
|
328
|
-
traces[1]['Op'].must_equal "get_indexed_slices"
|
329
|
-
traces[1]['Cf'].must_equal "Statuses"
|
330
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
331
|
-
validate_event_keys(traces[2], @exit_kvs)
|
332
|
-
end
|
333
|
-
|
334
|
-
it 'should trace add and remove of column family' do
|
335
|
-
cf_name = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
|
336
|
-
cf_def = CassandraThrift::CfDef.new(:keyspace => @ks_name, :name => cf_name)
|
337
|
-
|
338
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
339
|
-
@client.add_column_family(cf_def)
|
340
|
-
@client.drop_column_family(cf_name)
|
341
|
-
end
|
342
|
-
|
343
|
-
traces = get_all_traces
|
344
|
-
|
345
|
-
traces.count.must_equal 6
|
346
|
-
validate_outer_layers(traces, 'cassandra_test')
|
347
|
-
|
348
|
-
validate_event_keys(traces[1], @entry_kvs)
|
349
|
-
traces[1]['Op'].must_equal "add_column_family"
|
350
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
351
|
-
validate_event_keys(traces[2], @exit_kvs)
|
352
|
-
|
353
|
-
traces[3]['Op'].must_equal "drop_column_family"
|
354
|
-
traces[3]['Cf'].must_equal cf_name
|
355
|
-
traces[3].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
356
|
-
end
|
357
|
-
|
358
|
-
it 'should trace adding a keyspace' do
|
359
|
-
ks_name = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
|
360
|
-
ks_def = CassandraThrift::KsDef.new(:name => ks_name,
|
361
|
-
:strategy_class => "org.apache.cassandra.locator.SimpleStrategy",
|
362
|
-
:strategy_options => { 'replication_factor' => '2' },
|
363
|
-
:cf_defs => [])
|
364
|
-
|
365
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
366
|
-
@client.add_keyspace(ks_def)
|
367
|
-
@client.keyspace = ks_name
|
368
|
-
end
|
369
|
-
|
370
|
-
traces = get_all_traces
|
371
|
-
|
372
|
-
traces.count.must_equal 4
|
373
|
-
validate_outer_layers(traces, 'cassandra_test')
|
374
|
-
|
375
|
-
validate_event_keys(traces[1], @entry_kvs)
|
376
|
-
traces[1]['Op'].must_equal "add_keyspace"
|
377
|
-
traces[1]['Name'].must_equal ks_name
|
378
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
379
|
-
validate_event_keys(traces[2], @exit_kvs)
|
380
|
-
end
|
381
|
-
|
382
|
-
it 'should trace the removal of a keyspace' do
|
383
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
384
|
-
@client.drop_keyspace(@ks_name)
|
385
|
-
end
|
386
|
-
|
387
|
-
traces = get_all_traces
|
388
|
-
|
389
|
-
traces.count.must_equal 4
|
390
|
-
validate_outer_layers(traces, 'cassandra_test')
|
391
|
-
|
392
|
-
validate_event_keys(traces[1], @entry_kvs)
|
393
|
-
traces[1]['Op'].must_equal "drop_keyspace"
|
394
|
-
traces[1]['Name'].must_equal @ks_name
|
395
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:cassandra][:collect_backtraces]
|
396
|
-
validate_event_keys(traces[2], @exit_kvs)
|
397
|
-
end
|
398
|
-
|
399
|
-
it "should obey :collect_backtraces setting when true" do
|
400
|
-
AppOpticsAPM::Config[:cassandra][:collect_backtraces] = true
|
401
|
-
|
402
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
403
|
-
user = {'screen_name' => 'larry', "blah" => "ok"}
|
404
|
-
@client.insert(:Users, '5', user, { :ttl => 600, :consistency => 1})
|
405
|
-
end
|
406
|
-
|
407
|
-
traces = get_all_traces
|
408
|
-
layer_has_key(traces, 'cassandra', 'Backtrace')
|
409
|
-
end
|
410
|
-
|
411
|
-
it "should obey :collect_backtraces setting when false" do
|
412
|
-
AppOpticsAPM::Config[:cassandra][:collect_backtraces] = false
|
413
|
-
|
414
|
-
AppOpticsAPM::API.start_trace('cassandra_test', '', {}) do
|
415
|
-
user = {'screen_name' => 'larry', "blah" => "ok"}
|
416
|
-
@client.insert(:Users, '5', user, { :ttl => 600, :consistency => 1})
|
417
|
-
end
|
418
|
-
|
419
|
-
traces = get_all_traces
|
420
|
-
layer_doesnt_have_key(traces, 'cassandra', 'Backtrace')
|
421
|
-
end
|
422
|
-
|
423
|
-
end
|
424
|
-
end
|