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,310 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
if defined?(::Redis)
|
7
|
-
describe "Redis Lists" do
|
8
|
-
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
9
|
-
|
10
|
-
def min_server_version(version)
|
11
|
-
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
12
|
-
skip "supported only on redis-server #{version} or greater"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
before do
|
17
|
-
clear_all_traces
|
18
|
-
|
19
|
-
@redis ||= Redis.new
|
20
|
-
|
21
|
-
@redis_version ||= @redis.info["redis_version"]
|
22
|
-
|
23
|
-
# These are standard entry/exit KVs that are passed up with all moped operations
|
24
|
-
@entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
|
25
|
-
@exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
it "should trace blpop" do
|
30
|
-
min_server_version(2.0)
|
31
|
-
|
32
|
-
@redis.lpush("savage", "zombie")
|
33
|
-
|
34
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
35
|
-
@redis.blpop("savage")
|
36
|
-
end
|
37
|
-
|
38
|
-
traces = get_all_traces
|
39
|
-
traces.count.must_equal 4
|
40
|
-
traces[2]['KVOp'].must_equal "blpop"
|
41
|
-
traces[2]['KVKey'].must_equal "savage"
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should trace brpop" do
|
45
|
-
min_server_version(2.0)
|
46
|
-
|
47
|
-
@redis.lpush("savage", "the walking dead")
|
48
|
-
|
49
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
50
|
-
@redis.brpop("savage")
|
51
|
-
end
|
52
|
-
|
53
|
-
traces = get_all_traces
|
54
|
-
traces.count.must_equal 4
|
55
|
-
traces[2]['KVOp'].must_equal "brpop"
|
56
|
-
traces[2]['KVKey'].must_equal "savage"
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should trace brpoplpush" do
|
60
|
-
min_server_version(2.2)
|
61
|
-
|
62
|
-
@redis.lpush("savage", "night of the walking dead")
|
63
|
-
|
64
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
65
|
-
@redis.brpoplpush("savage", "crawlies")
|
66
|
-
end
|
67
|
-
|
68
|
-
traces = get_all_traces
|
69
|
-
traces.count.must_equal 4
|
70
|
-
traces[2]['KVOp'].must_equal "brpoplpush"
|
71
|
-
traces[2]['destination'].must_equal "crawlies"
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should trace lindex" do
|
75
|
-
min_server_version(1.0)
|
76
|
-
|
77
|
-
@redis.lpush("fringe", "bishop")
|
78
|
-
@redis.lpush("fringe", "dunham")
|
79
|
-
@redis.lpush("fringe", "broyles")
|
80
|
-
|
81
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
82
|
-
@redis.lindex("fringe", 1)
|
83
|
-
end
|
84
|
-
|
85
|
-
traces = get_all_traces
|
86
|
-
traces.count.must_equal 4
|
87
|
-
traces[2]['KVOp'].must_equal "lindex"
|
88
|
-
traces[2]['index'].must_equal 1
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should trace linsert" do
|
92
|
-
min_server_version(2.2)
|
93
|
-
|
94
|
-
@redis.lpush("gods of old", "sun")
|
95
|
-
@redis.lpush("gods of old", "moon")
|
96
|
-
@redis.lpush("gods of old", "night")
|
97
|
-
|
98
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
99
|
-
@redis.linsert("gods of old", "BEFORE", "night", "river")
|
100
|
-
end
|
101
|
-
|
102
|
-
traces = get_all_traces
|
103
|
-
traces.count.must_equal 4
|
104
|
-
traces[2]['KVOp'].must_equal "linsert"
|
105
|
-
traces[2]['KVKey'].must_equal "gods of old"
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should trace llen" do
|
109
|
-
min_server_version(1.0)
|
110
|
-
|
111
|
-
@redis.lpush("gods of old", "sun")
|
112
|
-
@redis.lpush("gods of old", "moon")
|
113
|
-
@redis.lpush("gods of old", "night")
|
114
|
-
|
115
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
116
|
-
@redis.llen("gods of old")
|
117
|
-
end
|
118
|
-
|
119
|
-
traces = get_all_traces
|
120
|
-
traces.count.must_equal 4
|
121
|
-
traces[2]['KVOp'].must_equal "llen"
|
122
|
-
traces[2]['KVKey'].must_equal "gods of old"
|
123
|
-
end
|
124
|
-
|
125
|
-
it "should trace lpop" do
|
126
|
-
min_server_version(1.0)
|
127
|
-
|
128
|
-
@redis.lpush("gods of old", "sun")
|
129
|
-
@redis.lpush("gods of old", "moon")
|
130
|
-
@redis.lpush("gods of old", "night")
|
131
|
-
|
132
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
133
|
-
@redis.lpop("gods of old")
|
134
|
-
end
|
135
|
-
|
136
|
-
traces = get_all_traces
|
137
|
-
traces.count.must_equal 4
|
138
|
-
traces[2]['KVOp'].must_equal "lpop"
|
139
|
-
traces[2]['KVKey'].must_equal "gods of old"
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should trace lpush" do
|
143
|
-
min_server_version(1.0)
|
144
|
-
|
145
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
146
|
-
@redis.lpush("gods of old", "night")
|
147
|
-
end
|
148
|
-
|
149
|
-
traces = get_all_traces
|
150
|
-
traces.count.must_equal 4
|
151
|
-
traces[2]['KVOp'].must_equal "lpush"
|
152
|
-
traces[2]['KVKey'].must_equal "gods of old"
|
153
|
-
end
|
154
|
-
|
155
|
-
it "should trace lpushx" do
|
156
|
-
min_server_version(2.2)
|
157
|
-
|
158
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
159
|
-
@redis.lpushx("gods of old", "night")
|
160
|
-
end
|
161
|
-
|
162
|
-
traces = get_all_traces
|
163
|
-
traces.count.must_equal 4
|
164
|
-
traces[2]['KVOp'].must_equal "lpushx"
|
165
|
-
traces[2]['KVKey'].must_equal "gods of old"
|
166
|
-
end
|
167
|
-
|
168
|
-
it "should trace lrange" do
|
169
|
-
min_server_version(1.0)
|
170
|
-
|
171
|
-
@redis.rpush("protein types", "structural")
|
172
|
-
@redis.rpush("protein types", "storage")
|
173
|
-
@redis.rpush("protein types", "hormonal")
|
174
|
-
@redis.rpush("protein types", "enzyme")
|
175
|
-
@redis.rpush("protein types", "immunoglobulins")
|
176
|
-
|
177
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
178
|
-
@redis.lrange("protein types", 2, 4)
|
179
|
-
end
|
180
|
-
|
181
|
-
traces = get_all_traces
|
182
|
-
traces.count.must_equal 4
|
183
|
-
traces[2]['KVOp'].must_equal "lrange"
|
184
|
-
traces[2]['KVKey'].must_equal "protein types"
|
185
|
-
traces[2]['start'].must_equal 2
|
186
|
-
traces[2]['stop'].must_equal 4
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should trace lrem" do
|
190
|
-
min_server_version(1.0)
|
191
|
-
|
192
|
-
@redis.rpush("australia", "sydney")
|
193
|
-
@redis.rpush("australia", "sydney")
|
194
|
-
@redis.rpush("australia", "albury")
|
195
|
-
@redis.rpush("australia", "tamworth")
|
196
|
-
@redis.rpush("australia", "tamworth")
|
197
|
-
@redis.rpush("australia", "penrith")
|
198
|
-
|
199
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
200
|
-
@redis.lrem("australia", -2, "sydney")
|
201
|
-
end
|
202
|
-
|
203
|
-
traces = get_all_traces
|
204
|
-
traces.count.must_equal 4
|
205
|
-
traces[2]['KVOp'].must_equal "lrem"
|
206
|
-
traces[2]['KVKey'].must_equal "australia"
|
207
|
-
end
|
208
|
-
|
209
|
-
it "should trace lset" do
|
210
|
-
min_server_version(1.0)
|
211
|
-
|
212
|
-
@redis.rpush("australia", "sydney")
|
213
|
-
@redis.rpush("australia", "albury")
|
214
|
-
@redis.rpush("australia", "tamworth")
|
215
|
-
@redis.rpush("australia", "penrith")
|
216
|
-
|
217
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
218
|
-
@redis.lset("australia", 2, "Kalgoorlie")
|
219
|
-
end
|
220
|
-
|
221
|
-
traces = get_all_traces
|
222
|
-
traces.count.must_equal 4
|
223
|
-
traces[2]['KVOp'].must_equal "lset"
|
224
|
-
traces[2]['KVKey'].must_equal "australia"
|
225
|
-
end
|
226
|
-
|
227
|
-
it "should trace ltrim" do
|
228
|
-
min_server_version(1.0)
|
229
|
-
|
230
|
-
@redis.rpush("australia", "sydney")
|
231
|
-
@redis.rpush("australia", "albury")
|
232
|
-
@redis.rpush("australia", "tamworth")
|
233
|
-
@redis.rpush("australia", "albury")
|
234
|
-
@redis.rpush("australia", "tamworth")
|
235
|
-
@redis.rpush("australia", "albury")
|
236
|
-
@redis.rpush("australia", "tamworth")
|
237
|
-
@redis.rpush("australia", "penrith")
|
238
|
-
|
239
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
240
|
-
@redis.ltrim("australia", 2, 6)
|
241
|
-
end
|
242
|
-
|
243
|
-
traces = get_all_traces
|
244
|
-
traces.count.must_equal 4
|
245
|
-
traces[2]['KVOp'].must_equal "ltrim"
|
246
|
-
traces[2]['KVKey'].must_equal "australia"
|
247
|
-
end
|
248
|
-
|
249
|
-
it "should trace rpop" do
|
250
|
-
min_server_version(1.0)
|
251
|
-
|
252
|
-
@redis.rpush("santa esmeralda", "house of the rising sun")
|
253
|
-
@redis.rpush("santa esmeralda", "don't let me be misunderstood")
|
254
|
-
@redis.rpush("santa esmeralda", "sevilla nights")
|
255
|
-
|
256
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
257
|
-
@redis.rpop("santa esmeralda")
|
258
|
-
end
|
259
|
-
|
260
|
-
traces = get_all_traces
|
261
|
-
traces.count.must_equal 4
|
262
|
-
traces[2]['KVOp'].must_equal "rpop"
|
263
|
-
traces[2]['KVKey'].must_equal "santa esmeralda"
|
264
|
-
end
|
265
|
-
|
266
|
-
it "should trace rpoplpush" do
|
267
|
-
min_server_version(1.2)
|
268
|
-
|
269
|
-
@redis.rpush("santa esmeralda", "house of the rising sun")
|
270
|
-
@redis.rpush("santa esmeralda", "don't let me be misunderstood")
|
271
|
-
@redis.rpush("santa esmeralda", "sevilla nights")
|
272
|
-
|
273
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
274
|
-
@redis.rpoplpush("santa esmeralda", "the gods of old")
|
275
|
-
end
|
276
|
-
|
277
|
-
traces = get_all_traces
|
278
|
-
traces.count.must_equal 4
|
279
|
-
traces[2]['KVOp'].must_equal "rpoplpush"
|
280
|
-
traces[2]['KVKey'].must_equal "santa esmeralda"
|
281
|
-
traces[2]['destination'].must_equal "the gods of old"
|
282
|
-
end
|
283
|
-
|
284
|
-
it "should trace rpush" do
|
285
|
-
min_server_version(1.0)
|
286
|
-
|
287
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
288
|
-
@redis.rpush("boney m", "rasputin")
|
289
|
-
end
|
290
|
-
|
291
|
-
traces = get_all_traces
|
292
|
-
traces.count.must_equal 4
|
293
|
-
traces[2]['KVOp'].must_equal "rpush"
|
294
|
-
traces[2]['KVKey'].must_equal "boney m"
|
295
|
-
end
|
296
|
-
|
297
|
-
it "should trace rpushx" do
|
298
|
-
min_server_version(1.0)
|
299
|
-
|
300
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
301
|
-
@redis.rpushx("boney m", "rasputin")
|
302
|
-
end
|
303
|
-
|
304
|
-
traces = get_all_traces
|
305
|
-
traces.count.must_equal 4
|
306
|
-
traces[2]['KVOp'].must_equal "rpushx"
|
307
|
-
traces[2]['KVKey'].must_equal "boney m"
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
@@ -1,163 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
require 'minitest_helper'
|
5
|
-
|
6
|
-
if defined?(::Redis)
|
7
|
-
describe "Redis Misc" do
|
8
|
-
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
9
|
-
|
10
|
-
def min_server_version(version)
|
11
|
-
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
12
|
-
skip "supported only on redis-server #{version} or greater"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
before do
|
17
|
-
clear_all_traces
|
18
|
-
|
19
|
-
@redis ||= Redis.new(:host => ENV['APPOPTICS_REDIS_SERVER'] || '127.0.0.1')
|
20
|
-
|
21
|
-
@redis_version ||= @redis.info["redis_version"]
|
22
|
-
|
23
|
-
# These are standard entry/exit KVs that are passed up with all moped operations
|
24
|
-
@entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
|
25
|
-
@exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should trace publish" do
|
29
|
-
min_server_version(2.0)
|
30
|
-
|
31
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
32
|
-
@redis.publish("channel1", "Broadcasting live from silicon circuits.")
|
33
|
-
end
|
34
|
-
|
35
|
-
traces = get_all_traces
|
36
|
-
traces.count.must_equal 4
|
37
|
-
traces[2]['KVOp'].must_equal "publish"
|
38
|
-
traces[2]['channel'].must_equal "channel1"
|
39
|
-
traces[2].has_key?('KVKey').must_equal false
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should trace select" do
|
43
|
-
min_server_version(2.0)
|
44
|
-
|
45
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
46
|
-
@redis.select(2)
|
47
|
-
end
|
48
|
-
|
49
|
-
traces = get_all_traces
|
50
|
-
traces.count.must_equal 4
|
51
|
-
traces[2]['KVOp'].must_equal "select"
|
52
|
-
traces[2]['db'].must_equal 2
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should trace pipelined operations" do
|
56
|
-
min_server_version(1.2)
|
57
|
-
|
58
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
59
|
-
@redis.pipelined do
|
60
|
-
@redis.zadd("staff", 0, "waiter")
|
61
|
-
@redis.zadd("staff", 1, "busser")
|
62
|
-
@redis.zadd("staff", 2, "chef")
|
63
|
-
|
64
|
-
@redis.lpush("fringe", "bishop")
|
65
|
-
@redis.lpush("fringe", "dunham")
|
66
|
-
@redis.lpush("fringe", "broyles")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
traces = get_all_traces
|
71
|
-
traces.count.must_equal 4
|
72
|
-
traces[2]['KVOpCount'].must_equal 6
|
73
|
-
traces[2]['KVOps'].must_equal "zadd, zadd, zadd, lpush, lpush, lpush"
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should trace multi with block" do
|
77
|
-
min_server_version(1.2)
|
78
|
-
|
79
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
80
|
-
@redis.multi do
|
81
|
-
@redis.zadd("presidents", 0, "Lincoln")
|
82
|
-
@redis.zadd("presidents", 1, "Adams")
|
83
|
-
@redis.zadd("presidents", 2, "Reagan")
|
84
|
-
|
85
|
-
@redis.lpush("hair", "blue")
|
86
|
-
@redis.lpush("hair", "gray")
|
87
|
-
@redis.lpush("hair", "yellow")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
traces = get_all_traces
|
92
|
-
traces.count.must_equal 4
|
93
|
-
traces[2]['KVOpCount'].must_equal 8
|
94
|
-
traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should trace eval" do
|
98
|
-
min_server_version(2.6)
|
99
|
-
|
100
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
101
|
-
@redis.eval("return 1")
|
102
|
-
@redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
|
103
|
-
@redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
|
104
|
-
end
|
105
|
-
|
106
|
-
traces = get_all_traces
|
107
|
-
traces.count.must_equal 8
|
108
|
-
traces[2]['KVOp'].must_equal "eval"
|
109
|
-
traces[2]['Script'].must_equal "return 1"
|
110
|
-
traces[4]['KVOp'].must_equal "eval"
|
111
|
-
traces[4]['Script'].must_equal "return { KEYS, ARGV }"
|
112
|
-
traces[6]['KVOp'].must_equal "eval"
|
113
|
-
traces[6]['Script'].must_equal "return { KEYS, ARGV }"
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should trace evalsha" do
|
117
|
-
min_server_version(2.6)
|
118
|
-
|
119
|
-
sha = @redis.script(:load, "return 1")
|
120
|
-
|
121
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
122
|
-
@redis.evalsha(sha)
|
123
|
-
end
|
124
|
-
|
125
|
-
traces = get_all_traces
|
126
|
-
traces.count.must_equal 4
|
127
|
-
traces[2]['KVOp'].must_equal "evalsha"
|
128
|
-
traces[2]['sha'].must_equal sha
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should trace script" do
|
132
|
-
min_server_version(2.6)
|
133
|
-
|
134
|
-
AppOpticsAPM::API.start_trace('redis_test', '', {}) do
|
135
|
-
@sha = @redis.script(:load, "return 1")
|
136
|
-
@it_exists1 = @redis.script(:exists, @sha)
|
137
|
-
@it_exists2 = @redis.script(:exists, [@sha, "other_sha"])
|
138
|
-
@redis.script(:flush)
|
139
|
-
end
|
140
|
-
|
141
|
-
traces = get_all_traces
|
142
|
-
traces.count.must_equal 10
|
143
|
-
|
144
|
-
# Validate return values
|
145
|
-
@it_exists1.must_equal true
|
146
|
-
@it_exists2.is_a?(Array).must_equal true
|
147
|
-
@it_exists2[0].must_equal true
|
148
|
-
@it_exists2[1].must_equal false
|
149
|
-
|
150
|
-
traces[2]['KVOp'].must_equal "script"
|
151
|
-
traces[2]['subcommand'].must_equal "load"
|
152
|
-
traces[2]['Script'].must_equal "return 1"
|
153
|
-
traces[4]['KVOp'].must_equal "script"
|
154
|
-
traces[4]['subcommand'].must_equal "exists"
|
155
|
-
traces[4]['KVKey'].must_equal @sha
|
156
|
-
traces[6]['KVOp'].must_equal "script"
|
157
|
-
traces[6]['subcommand'].must_equal "exists"
|
158
|
-
traces[6]['KVKey'].must_equal '["e0e1f9fabfc9d4800c877a703b823ac0578ff8db", "other_sha"]'
|
159
|
-
traces[8]['KVOp'].must_equal "script"
|
160
|
-
traces[8]['subcommand'].must_equal "flush"
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|