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,260 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
# Since memcache is loaded late, the instrumentation
|
7
|
-
# loaded out of order. Here we force inject instrumentation
|
8
|
-
require 'memcache'
|
9
|
-
::MemCache.class_eval do
|
10
|
-
include AppOpticsAPM::Inst::MemCache
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "Memcache" do
|
14
|
-
before do
|
15
|
-
clear_all_traces
|
16
|
-
@mc = ::MemCache.new('127.0.0.1')
|
17
|
-
|
18
|
-
# These are standard entry/exit KVs that are passed up with all mongo operations
|
19
|
-
@entry_kvs = {
|
20
|
-
'Layer' => 'memcache',
|
21
|
-
'Label' => 'entry' }
|
22
|
-
|
23
|
-
@info_kvs = {
|
24
|
-
'Layer' => 'memcache',
|
25
|
-
'Label' => 'info' }
|
26
|
-
|
27
|
-
@exit_kvs = { 'Layer' => 'memcache', 'Label' => 'exit' }
|
28
|
-
@collect_backtraces = AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
29
|
-
end
|
30
|
-
|
31
|
-
after do
|
32
|
-
AppOpticsAPM::Config[:memcache][:collect_backtraces] = @collect_backtraces
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'Stock MemCache should be loaded, defined and ready' do
|
36
|
-
defined?(::MemCache).wont_match nil
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'MemCache should have appoptics_apm methods defined' do
|
40
|
-
AppOpticsAPM::API::Memcache::MEMCACHE_OPS.each do |m|
|
41
|
-
if ::MemCache.method_defined?(m)
|
42
|
-
::MemCache.method_defined?("#{m}_with_appoptics").must_equal true
|
43
|
-
end
|
44
|
-
::MemCache.method_defined?(:request_setup_with_appoptics).must_equal true
|
45
|
-
::MemCache.method_defined?(:cache_get_with_appoptics).must_equal true
|
46
|
-
::MemCache.method_defined?(:get_multi_with_appoptics).must_equal true
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should trace set" do
|
51
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
52
|
-
@mc.set('msg', 'blah')
|
53
|
-
end
|
54
|
-
|
55
|
-
traces = get_all_traces
|
56
|
-
|
57
|
-
traces.count.must_equal 5
|
58
|
-
validate_outer_layers(traces, 'memcache_test')
|
59
|
-
|
60
|
-
validate_event_keys(traces[1], @entry_kvs)
|
61
|
-
|
62
|
-
traces[1]['KVOp'].must_equal "set"
|
63
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
64
|
-
|
65
|
-
validate_event_keys(traces[2], @info_kvs)
|
66
|
-
traces[2]['KVKey'].must_equal "msg"
|
67
|
-
traces[2].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
68
|
-
|
69
|
-
validate_event_keys(traces[3], @exit_kvs)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should trace get" do
|
73
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
74
|
-
@mc.get('msg')
|
75
|
-
end
|
76
|
-
|
77
|
-
traces = get_all_traces
|
78
|
-
|
79
|
-
traces.count.must_equal 6
|
80
|
-
validate_outer_layers(traces, 'memcache_test')
|
81
|
-
|
82
|
-
validate_event_keys(traces[1], @entry_kvs)
|
83
|
-
|
84
|
-
traces[1]['KVOp'].must_equal "get"
|
85
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
86
|
-
|
87
|
-
validate_event_keys(traces[2], @info_kvs)
|
88
|
-
traces[2]['KVKey'].must_equal "msg"
|
89
|
-
traces[2]['RemoteHost'].must_equal "127.0.0.1"
|
90
|
-
traces[2].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
91
|
-
|
92
|
-
traces[3].has_key?('KVHit').must_equal true
|
93
|
-
traces[3].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
94
|
-
|
95
|
-
validate_event_keys(traces[4], @exit_kvs)
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should trace get_multi" do
|
99
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
100
|
-
@mc.get_multi(['one', 'two', 'three', 'four', 'five', 'six'])
|
101
|
-
end
|
102
|
-
|
103
|
-
traces = get_all_traces
|
104
|
-
|
105
|
-
traces.count.must_equal 5
|
106
|
-
validate_outer_layers(traces, 'memcache_test')
|
107
|
-
|
108
|
-
validate_event_keys(traces[1], @entry_kvs)
|
109
|
-
|
110
|
-
traces[1]['KVOp'].must_equal "get_multi"
|
111
|
-
|
112
|
-
validate_event_keys(traces[2], @info_kvs)
|
113
|
-
traces[2]['KVKeyCount'].must_equal 6
|
114
|
-
traces[2].has_key?('KVHitCount').must_equal true
|
115
|
-
traces[2].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
116
|
-
|
117
|
-
validate_event_keys(traces[3], @exit_kvs)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should trace add for existing key" do
|
121
|
-
@mc.set('testKey', 'x', 1200)
|
122
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
123
|
-
@mc.add('testKey', 'x', 1200)
|
124
|
-
end
|
125
|
-
|
126
|
-
traces = get_all_traces
|
127
|
-
|
128
|
-
traces.count.must_equal 5
|
129
|
-
validate_outer_layers(traces, 'memcache_test')
|
130
|
-
|
131
|
-
validate_event_keys(traces[1], @entry_kvs)
|
132
|
-
|
133
|
-
traces[1]['KVOp'].must_equal "add"
|
134
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
135
|
-
|
136
|
-
validate_event_keys(traces[2], @info_kvs)
|
137
|
-
traces[2]['KVKey'].must_equal "testKey"
|
138
|
-
|
139
|
-
validate_event_keys(traces[3], @exit_kvs)
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should trace append" do
|
143
|
-
@mc.set('rawKey', "Peanut Butter ", 600, :raw => true)
|
144
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
145
|
-
@mc.append('rawKey', "Jelly")
|
146
|
-
end
|
147
|
-
|
148
|
-
traces = get_all_traces
|
149
|
-
|
150
|
-
traces.count.must_equal 5
|
151
|
-
validate_outer_layers(traces, 'memcache_test')
|
152
|
-
|
153
|
-
validate_event_keys(traces[1], @entry_kvs)
|
154
|
-
|
155
|
-
traces[1]['KVOp'].must_equal "append"
|
156
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
157
|
-
|
158
|
-
validate_event_keys(traces[2], @info_kvs)
|
159
|
-
|
160
|
-
traces[2]['KVKey'].must_equal "rawKey"
|
161
|
-
traces[2].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
162
|
-
|
163
|
-
validate_event_keys(traces[3], @exit_kvs)
|
164
|
-
end
|
165
|
-
|
166
|
-
it "should trace decrement" do
|
167
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
168
|
-
@mc.decr('memcache_key_counter', 1)
|
169
|
-
end
|
170
|
-
|
171
|
-
traces = get_all_traces
|
172
|
-
|
173
|
-
traces.count.must_equal 5
|
174
|
-
validate_outer_layers(traces, 'memcache_test')
|
175
|
-
|
176
|
-
validate_event_keys(traces[1], @entry_kvs)
|
177
|
-
|
178
|
-
traces[1]['KVOp'].must_equal "decr"
|
179
|
-
traces[1].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
180
|
-
|
181
|
-
traces[2]['KVKey'].must_equal "memcache_key_counter"
|
182
|
-
traces[2].has_key?('Backtrace').must_equal AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
183
|
-
|
184
|
-
validate_event_keys(traces[3], @exit_kvs)
|
185
|
-
end
|
186
|
-
|
187
|
-
it "should trace increment" do
|
188
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
189
|
-
@mc.incr("memcache_key_counter", 1)
|
190
|
-
end
|
191
|
-
|
192
|
-
traces = get_all_traces
|
193
|
-
|
194
|
-
traces.count.must_equal 5
|
195
|
-
validate_outer_layers(traces, 'memcache_test')
|
196
|
-
|
197
|
-
validate_event_keys(traces[1], @entry_kvs)
|
198
|
-
traces[1]['KVOp'].must_equal "incr"
|
199
|
-
validate_event_keys(traces[2], @info_kvs)
|
200
|
-
traces[2]['KVKey'].must_equal "memcache_key_counter"
|
201
|
-
validate_event_keys(traces[3], @exit_kvs)
|
202
|
-
end
|
203
|
-
|
204
|
-
it "should trace replace" do
|
205
|
-
@mc.set("some_key", "blah")
|
206
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
207
|
-
@mc.replace("some_key", "woop")
|
208
|
-
end
|
209
|
-
|
210
|
-
traces = get_all_traces
|
211
|
-
|
212
|
-
traces.count.must_equal 5
|
213
|
-
validate_outer_layers(traces, 'memcache_test')
|
214
|
-
|
215
|
-
validate_event_keys(traces[1], @entry_kvs)
|
216
|
-
traces[1]['KVOp'].must_equal "replace"
|
217
|
-
traces[2]['KVKey'].must_equal "some_key"
|
218
|
-
validate_event_keys(traces[2], @info_kvs)
|
219
|
-
validate_event_keys(traces[3], @exit_kvs)
|
220
|
-
end
|
221
|
-
|
222
|
-
it "should trace delete" do
|
223
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
224
|
-
@mc.delete("some_key")
|
225
|
-
end
|
226
|
-
|
227
|
-
traces = get_all_traces
|
228
|
-
|
229
|
-
traces.count.must_equal 5
|
230
|
-
validate_outer_layers(traces, 'memcache_test')
|
231
|
-
|
232
|
-
validate_event_keys(traces[1], @entry_kvs)
|
233
|
-
traces[1]['KVOp'].must_equal "delete"
|
234
|
-
traces[2]['KVKey'].must_equal "some_key"
|
235
|
-
validate_event_keys(traces[2], @info_kvs)
|
236
|
-
validate_event_keys(traces[3], @exit_kvs)
|
237
|
-
end
|
238
|
-
|
239
|
-
it "should obey :collect_backtraces setting when true" do
|
240
|
-
AppOpticsAPM::Config[:memcache][:collect_backtraces] = true
|
241
|
-
|
242
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
243
|
-
@mc.set('some_key', 1)
|
244
|
-
end
|
245
|
-
|
246
|
-
traces = get_all_traces
|
247
|
-
layer_has_key(traces, 'memcache', 'Backtrace')
|
248
|
-
end
|
249
|
-
|
250
|
-
it "should obey :collect_backtraces setting when false" do
|
251
|
-
AppOpticsAPM::Config[:memcache][:collect_backtraces] = false
|
252
|
-
|
253
|
-
AppOpticsAPM::API.start_trace('memcache_test', '', {}) do
|
254
|
-
@mc.set('some_key', 1)
|
255
|
-
end
|
256
|
-
|
257
|
-
traces = get_all_traces
|
258
|
-
layer_doesnt_have_key(traces, 'memcache', 'Backtrace')
|
259
|
-
end
|
260
|
-
end
|
@@ -1,229 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
if RUBY_VERSION < '2.0' and not defined?(JRUBY_VERSION)
|
7
|
-
describe "Memcached" do
|
8
|
-
require 'memcached'
|
9
|
-
require 'memcached/rails'
|
10
|
-
|
11
|
-
before do
|
12
|
-
clear_all_traces
|
13
|
-
@mc = ::Memcached::Rails.new(:servers => ['127.0.0.1'])
|
14
|
-
|
15
|
-
# These are standard entry/exit KVs that are passed up with all mongo operations
|
16
|
-
@entry_kvs = {
|
17
|
-
'Layer' => 'memcache',
|
18
|
-
'Label' => 'entry' }
|
19
|
-
|
20
|
-
@info_kvs = {
|
21
|
-
'Layer' => 'memcache',
|
22
|
-
'Label' => 'info' }
|
23
|
-
|
24
|
-
@exit_kvs = { 'Layer' => 'memcache', 'Label' => 'exit' }
|
25
|
-
@collect_backtraces = AppOpticsAPM::Config[:memcached][:collect_backtraces]
|
26
|
-
end
|
27
|
-
|
28
|
-
after do
|
29
|
-
AppOpticsAPM::Config[:memcached][:collect_backtraces] = @collect_backtraces
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'Stock Memcached should be loaded, defined and ready' do
|
33
|
-
defined?(::Memcached).wont_match nil
|
34
|
-
defined?(::Memcached::Rails).wont_match nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'Memcached should have appoptics_apm methods defined' do
|
38
|
-
AppOpticsAPM::API::Memcache::MEMCACHE_OPS.each do |m|
|
39
|
-
if ::Memcached.method_defined?(m)
|
40
|
-
::Memcached.method_defined?("#{m}_with_appoptics").must_equal true
|
41
|
-
end
|
42
|
-
::Memcached::Rails.method_defined?(:get_multi_with_appoptics).must_equal true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should trace set" do
|
47
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
48
|
-
@mc.set('testKey', 'blah')
|
49
|
-
end
|
50
|
-
|
51
|
-
traces = get_all_traces
|
52
|
-
traces.count.must_equal 4
|
53
|
-
|
54
|
-
validate_outer_layers(traces, 'memcached_test')
|
55
|
-
validate_event_keys(traces[1], @entry_kvs)
|
56
|
-
validate_event_keys(traces[2], @exit_kvs)
|
57
|
-
|
58
|
-
traces[1]['KVOp'].must_equal "set"
|
59
|
-
traces[1]['KVKey'].must_equal "testKey"
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should trace get" do
|
63
|
-
@mc.set('testKey', 'blah')
|
64
|
-
|
65
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
66
|
-
@mc.get('testKey')
|
67
|
-
end
|
68
|
-
|
69
|
-
traces = get_all_traces
|
70
|
-
traces.count.must_equal 4
|
71
|
-
|
72
|
-
validate_outer_layers(traces, 'memcached_test')
|
73
|
-
validate_event_keys(traces[1], @entry_kvs)
|
74
|
-
validate_event_keys(traces[2], @exit_kvs)
|
75
|
-
|
76
|
-
traces[1]['KVOp'].must_equal "get"
|
77
|
-
traces[1]['KVKey'].must_equal "testKey"
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should trace get_multi" do
|
81
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
82
|
-
@mc.get_multi(['one', 'two', 'three', 'four', 'five', 'six'])
|
83
|
-
end
|
84
|
-
|
85
|
-
traces = get_all_traces
|
86
|
-
traces.count.must_equal 5
|
87
|
-
|
88
|
-
validate_outer_layers(traces, 'memcached_test')
|
89
|
-
validate_event_keys(traces[1], @entry_kvs)
|
90
|
-
validate_event_keys(traces[2], @info_kvs)
|
91
|
-
validate_event_keys(traces[3], @exit_kvs)
|
92
|
-
|
93
|
-
traces[1]['KVOp'].must_equal "get_multi"
|
94
|
-
|
95
|
-
traces[2]['KVKeyCount'].must_equal 6
|
96
|
-
traces[2].has_key?('KVHitCount').must_equal true
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should trace add for existing key" do
|
100
|
-
@mc.set('testKey', 'x', 1200)
|
101
|
-
|
102
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
103
|
-
@mc.add('testKey', 'x', 1200)
|
104
|
-
end
|
105
|
-
|
106
|
-
traces = get_all_traces
|
107
|
-
traces.count.must_equal 5
|
108
|
-
|
109
|
-
validate_outer_layers(traces, 'memcached_test')
|
110
|
-
validate_event_keys(traces[1], @entry_kvs)
|
111
|
-
validate_event_keys(traces[3], @exit_kvs)
|
112
|
-
|
113
|
-
traces[1]['KVOp'].must_equal "add"
|
114
|
-
traces[1]['KVKey'].must_equal "testKey"
|
115
|
-
|
116
|
-
traces[2]['ErrorClass'].must_equal "Memcached::NotStored"
|
117
|
-
traces[2]['ErrorMsg'].must_equal "Memcached::NotStored"
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should trace append" do
|
121
|
-
@mc.set('rawKey', "Peanut Butter ", 600, :raw => true)
|
122
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
123
|
-
@mc.append('rawKey', "Jelly")
|
124
|
-
end
|
125
|
-
|
126
|
-
traces = get_all_traces
|
127
|
-
traces.count.must_equal 4
|
128
|
-
|
129
|
-
validate_outer_layers(traces, 'memcached_test')
|
130
|
-
validate_event_keys(traces[1], @entry_kvs)
|
131
|
-
validate_event_keys(traces[2], @exit_kvs)
|
132
|
-
|
133
|
-
traces[1]['KVOp'].must_equal "append"
|
134
|
-
traces[1]['KVKey'].must_equal "rawKey"
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should trace decr" do
|
138
|
-
@mc.set('some_key_counter', "100", 0, false)
|
139
|
-
|
140
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
141
|
-
@mc.decr('some_key_counter', 1)
|
142
|
-
end
|
143
|
-
|
144
|
-
traces = get_all_traces
|
145
|
-
traces.count.must_equal 4
|
146
|
-
|
147
|
-
validate_outer_layers(traces, 'memcached_test')
|
148
|
-
validate_event_keys(traces[1], @entry_kvs)
|
149
|
-
validate_event_keys(traces[2], @exit_kvs)
|
150
|
-
|
151
|
-
traces[1]['KVOp'].must_equal "decr"
|
152
|
-
traces[1]['KVKey'].must_equal "some_key_counter"
|
153
|
-
end
|
154
|
-
|
155
|
-
it "should trace increment" do
|
156
|
-
@mc.set('some_key_counter', "100", 0, false)
|
157
|
-
|
158
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
159
|
-
@mc.incr("some_key_counter", 1)
|
160
|
-
end
|
161
|
-
|
162
|
-
traces = get_all_traces
|
163
|
-
traces.count.must_equal 4
|
164
|
-
|
165
|
-
validate_outer_layers(traces, 'memcached_test')
|
166
|
-
validate_event_keys(traces[1], @entry_kvs)
|
167
|
-
validate_event_keys(traces[2], @exit_kvs)
|
168
|
-
|
169
|
-
traces[1]['KVOp'].must_equal "incr"
|
170
|
-
traces[1]['KVKey'].must_equal "some_key_counter"
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should trace replace" do
|
174
|
-
@mc.set('some_key', 'blah')
|
175
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
176
|
-
@mc.replace("some_key", "woop")
|
177
|
-
end
|
178
|
-
|
179
|
-
traces = get_all_traces
|
180
|
-
traces.count.must_equal 4
|
181
|
-
|
182
|
-
validate_outer_layers(traces, 'memcached_test')
|
183
|
-
validate_event_keys(traces[1], @entry_kvs)
|
184
|
-
validate_event_keys(traces[2], @exit_kvs)
|
185
|
-
|
186
|
-
traces[1]['KVOp'].must_equal "replace"
|
187
|
-
traces[1]['KVKey'].must_equal "some_key"
|
188
|
-
end
|
189
|
-
|
190
|
-
it "should trace delete" do
|
191
|
-
@mc.set('some_key', 'blah')
|
192
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
193
|
-
@mc.delete("some_key")
|
194
|
-
end
|
195
|
-
|
196
|
-
traces = get_all_traces
|
197
|
-
traces.count.must_equal 4
|
198
|
-
|
199
|
-
validate_outer_layers(traces, 'memcached_test')
|
200
|
-
validate_event_keys(traces[1], @entry_kvs)
|
201
|
-
validate_event_keys(traces[2], @exit_kvs)
|
202
|
-
|
203
|
-
traces[1]['KVOp'].must_equal "delete"
|
204
|
-
traces[1]['KVKey'].must_equal "some_key"
|
205
|
-
end
|
206
|
-
|
207
|
-
it "should obey :collect_backtraces setting when true" do
|
208
|
-
AppOpticsAPM::Config[:memcached][:collect_backtraces] = true
|
209
|
-
|
210
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
211
|
-
@mc.set('some_key', 1)
|
212
|
-
end
|
213
|
-
|
214
|
-
traces = get_all_traces
|
215
|
-
layer_has_key(traces, 'memcache', 'Backtrace')
|
216
|
-
end
|
217
|
-
|
218
|
-
it "should obey :collect_backtraces setting when false" do
|
219
|
-
AppOpticsAPM::Config[:memcached][:collect_backtraces] = false
|
220
|
-
|
221
|
-
AppOpticsAPM::API.start_trace('memcached_test', '', {}) do
|
222
|
-
@mc.set('some_key', 1)
|
223
|
-
end
|
224
|
-
|
225
|
-
traces = get_all_traces
|
226
|
-
layer_doesnt_have_key(traces, 'memcache', 'Backtrace')
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|