oboe 2.7.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +51 -0
- data/Appraisals +10 -0
- data/CHANGELOG.md +223 -0
- data/Gemfile +49 -0
- data/LICENSE +199 -0
- data/README.md +380 -0
- data/Rakefile +106 -0
- data/ext/oboe_metal/extconf.rb +61 -0
- data/ext/oboe_metal/noop/noop.c +7 -0
- data/ext/oboe_metal/src/bson/bson.h +221 -0
- data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
- data/ext/oboe_metal/src/oboe.h +275 -0
- data/ext/oboe_metal/src/oboe.hpp +352 -0
- data/ext/oboe_metal/src/oboe_wrap.cxx +3886 -0
- data/ext/oboe_metal/tests/test.rb +11 -0
- data/gemfiles/mongo.gemfile +33 -0
- data/gemfiles/moped.gemfile +33 -0
- data/get_version.rb +5 -0
- data/init.rb +4 -0
- data/lib/base.rb +99 -0
- data/lib/joboe_metal.rb +185 -0
- data/lib/method_profiling.rb +70 -0
- data/lib/oboe.rb +50 -0
- data/lib/oboe/api.rb +14 -0
- data/lib/oboe/api/layerinit.rb +99 -0
- data/lib/oboe/api/logging.rb +129 -0
- data/lib/oboe/api/memcache.rb +29 -0
- data/lib/oboe/api/profiling.rb +50 -0
- data/lib/oboe/api/tracing.rb +134 -0
- data/lib/oboe/api/util.rb +117 -0
- data/lib/oboe/config.rb +140 -0
- data/lib/oboe/frameworks/grape.rb +74 -0
- data/lib/oboe/frameworks/padrino.rb +66 -0
- data/lib/oboe/frameworks/padrino/templates.rb +59 -0
- data/lib/oboe/frameworks/rails.rb +139 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_ajax_header.js.erb +5 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_footer.js.erb +1 -0
- data/lib/oboe/frameworks/rails/helpers/rum/rum_header.js.erb +3 -0
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +123 -0
- data/lib/oboe/frameworks/rails/inst/action_view.rb +56 -0
- data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +54 -0
- data/lib/oboe/frameworks/rails/inst/action_view_30.rb +48 -0
- data/lib/oboe/frameworks/rails/inst/active_record.rb +24 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +28 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +18 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +30 -0
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +118 -0
- data/lib/oboe/frameworks/sinatra.rb +96 -0
- data/lib/oboe/frameworks/sinatra/templates.rb +56 -0
- data/lib/oboe/inst/cassandra.rb +281 -0
- data/lib/oboe/inst/dalli.rb +75 -0
- data/lib/oboe/inst/http.rb +72 -0
- data/lib/oboe/inst/memcache.rb +105 -0
- data/lib/oboe/inst/memcached.rb +96 -0
- data/lib/oboe/inst/mongo.rb +240 -0
- data/lib/oboe/inst/moped.rb +474 -0
- data/lib/oboe/inst/rack.rb +81 -0
- data/lib/oboe/inst/redis.rb +273 -0
- data/lib/oboe/inst/resque.rb +193 -0
- data/lib/oboe/instrumentation.rb +18 -0
- data/lib/oboe/loading.rb +98 -0
- data/lib/oboe/logger.rb +41 -0
- data/lib/oboe/ruby.rb +11 -0
- data/lib/oboe/util.rb +129 -0
- data/lib/oboe/version.rb +13 -0
- data/lib/oboe/xtrace.rb +52 -0
- data/lib/oboe_metal.rb +140 -0
- data/lib/rails/generators/oboe/install_generator.rb +76 -0
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +94 -0
- data/oboe.gemspec +29 -0
- data/release.sh +65 -0
- data/test/frameworks/apps/grape_simple.rb +10 -0
- data/test/frameworks/apps/padrino_simple.rb +41 -0
- data/test/frameworks/apps/sinatra_simple.rb +20 -0
- data/test/frameworks/grape_test.rb +27 -0
- data/test/frameworks/padrino_test.rb +25 -0
- data/test/frameworks/sinatra_test.rb +25 -0
- data/test/instrumentation/cassandra_test.rb +381 -0
- data/test/instrumentation/dalli_test.rb +164 -0
- data/test/instrumentation/http_test.rb +97 -0
- data/test/instrumentation/memcache_test.rb +251 -0
- data/test/instrumentation/memcached_test.rb +226 -0
- data/test/instrumentation/mongo_test.rb +462 -0
- data/test/instrumentation/moped_test.rb +473 -0
- data/test/instrumentation/rack_test.rb +73 -0
- data/test/instrumentation/redis_hashes_test.rb +265 -0
- data/test/instrumentation/redis_keys_test.rb +318 -0
- data/test/instrumentation/redis_lists_test.rb +310 -0
- data/test/instrumentation/redis_misc_test.rb +160 -0
- data/test/instrumentation/redis_sets_test.rb +293 -0
- data/test/instrumentation/redis_sortedsets_test.rb +325 -0
- data/test/instrumentation/redis_strings_test.rb +333 -0
- data/test/instrumentation/resque_test.rb +62 -0
- data/test/minitest_helper.rb +148 -0
- data/test/profiling/method_test.rb +198 -0
- data/test/support/config_test.rb +39 -0
- data/test/support/liboboe_settings_test.rb +46 -0
- data/test/support/xtrace_test.rb +35 -0
- metadata +200 -0
@@ -0,0 +1,310 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require "redis"
|
3
|
+
|
4
|
+
describe Oboe::Inst::Redis, :lists do
|
5
|
+
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
|
+
|
7
|
+
def min_server_version(version)
|
8
|
+
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
9
|
+
skip "supported only on redis-server #{version} or greater"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
before do
|
14
|
+
clear_all_traces
|
15
|
+
|
16
|
+
@redis ||= Redis.new
|
17
|
+
|
18
|
+
@redis_version ||= @redis.info["redis_version"]
|
19
|
+
|
20
|
+
# These are standard entry/exit KVs that are passed up with all moped operations
|
21
|
+
@entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
|
22
|
+
@exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'Stock Redis should be loaded, defined and ready' do
|
26
|
+
defined?(::Redis).wont_match nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should trace blpop" do
|
30
|
+
min_server_version(2.0)
|
31
|
+
|
32
|
+
@redis.lpush("savage", "zombie")
|
33
|
+
|
34
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
Oboe::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
|
+
|
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
require "redis"
|
3
|
+
|
4
|
+
describe Oboe::Inst::Redis, :misc do
|
5
|
+
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
|
+
|
7
|
+
def min_server_version(version)
|
8
|
+
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
9
|
+
skip "supported only on redis-server #{version} or greater"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
before do
|
14
|
+
clear_all_traces
|
15
|
+
|
16
|
+
@redis ||= Redis.new
|
17
|
+
|
18
|
+
@redis_version ||= @redis.info["redis_version"]
|
19
|
+
|
20
|
+
# These are standard entry/exit KVs that are passed up with all moped operations
|
21
|
+
@entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
|
22
|
+
@exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should trace publish" do
|
26
|
+
min_server_version(2.0)
|
27
|
+
|
28
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
29
|
+
@redis.publish("channel1", "Broadcasting live from silicon circuits.")
|
30
|
+
end
|
31
|
+
|
32
|
+
traces = get_all_traces
|
33
|
+
traces.count.must_equal 4
|
34
|
+
traces[2]['KVOp'].must_equal "publish"
|
35
|
+
traces[2]['channel'].must_equal "channel1"
|
36
|
+
traces[2].has_key?('KVKey').must_equal false
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should trace select" do
|
40
|
+
min_server_version(2.0)
|
41
|
+
|
42
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
43
|
+
@redis.select(2)
|
44
|
+
end
|
45
|
+
|
46
|
+
traces = get_all_traces
|
47
|
+
traces.count.must_equal 4
|
48
|
+
traces[2]['KVOp'].must_equal "select"
|
49
|
+
traces[2]['db'].must_equal "2"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should trace pipelined operations" do
|
53
|
+
min_server_version(1.2)
|
54
|
+
|
55
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
56
|
+
@redis.pipelined do
|
57
|
+
@redis.zadd("staff", 0, "waiter")
|
58
|
+
@redis.zadd("staff", 1, "busser")
|
59
|
+
@redis.zadd("staff", 2, "chef")
|
60
|
+
|
61
|
+
@redis.lpush("fringe", "bishop")
|
62
|
+
@redis.lpush("fringe", "dunham")
|
63
|
+
@redis.lpush("fringe", "broyles")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
traces = get_all_traces
|
68
|
+
traces.count.must_equal 4
|
69
|
+
traces[2]['KVOpCount'].must_equal "6"
|
70
|
+
traces[2]['KVOps'].must_equal "zadd, zadd, zadd, lpush, lpush, lpush"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should trace multi with block" do
|
74
|
+
min_server_version(1.2)
|
75
|
+
|
76
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
77
|
+
@redis.multi do
|
78
|
+
@redis.zadd("presidents", 0, "Lincoln")
|
79
|
+
@redis.zadd("presidents", 1, "Adams")
|
80
|
+
@redis.zadd("presidents", 2, "Reagan")
|
81
|
+
|
82
|
+
@redis.lpush("hair", "blue")
|
83
|
+
@redis.lpush("hair", "gray")
|
84
|
+
@redis.lpush("hair", "yellow")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
traces = get_all_traces
|
89
|
+
traces.count.must_equal 4
|
90
|
+
traces[2]['KVOpCount'].must_equal "8"
|
91
|
+
traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should trace eval" do
|
95
|
+
min_server_version(2.6)
|
96
|
+
|
97
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
98
|
+
@redis.eval("return 1")
|
99
|
+
@redis.eval("return { KEYS, ARGV }", ["k1", "k2"], ["a1", "a2"])
|
100
|
+
@redis.eval("return { KEYS, ARGV }", :keys => ["k1", "k2"], :argv => ["a1", "a2"])
|
101
|
+
end
|
102
|
+
|
103
|
+
traces = get_all_traces
|
104
|
+
traces.count.must_equal 8
|
105
|
+
traces[2]['KVOp'].must_equal "eval"
|
106
|
+
traces[2]['Script'].must_equal "return 1"
|
107
|
+
traces[4]['KVOp'].must_equal "eval"
|
108
|
+
traces[4]['Script'].must_equal "return { KEYS, ARGV }"
|
109
|
+
traces[6]['KVOp'].must_equal "eval"
|
110
|
+
traces[6]['Script'].must_equal "return { KEYS, ARGV }"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should trace evalsha" do
|
114
|
+
min_server_version(2.6)
|
115
|
+
|
116
|
+
sha = @redis.script(:load, "return 1")
|
117
|
+
|
118
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
119
|
+
@redis.evalsha(sha)
|
120
|
+
end
|
121
|
+
|
122
|
+
traces = get_all_traces
|
123
|
+
traces.count.must_equal 4
|
124
|
+
traces[2]['KVOp'].must_equal "evalsha"
|
125
|
+
traces[2]['sha'].must_equal sha
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should trace script" do
|
129
|
+
min_server_version(2.6)
|
130
|
+
|
131
|
+
Oboe::API.start_trace('redis_test', '', {}) do
|
132
|
+
@sha = @redis.script(:load, "return 1")
|
133
|
+
@it_exists1 = @redis.script(:exists, @sha)
|
134
|
+
@it_exists2 = @redis.script(:exists, [@sha, "other_sha"])
|
135
|
+
@redis.script(:flush)
|
136
|
+
end
|
137
|
+
|
138
|
+
traces = get_all_traces
|
139
|
+
traces.count.must_equal 10
|
140
|
+
|
141
|
+
# Validate return values
|
142
|
+
@it_exists1.must_equal true
|
143
|
+
@it_exists2.is_a?(Array).must_equal true
|
144
|
+
@it_exists2[0].must_equal true
|
145
|
+
@it_exists2[1].must_equal false
|
146
|
+
|
147
|
+
traces[2]['KVOp'].must_equal "script"
|
148
|
+
traces[2]['subcommand'].must_equal "load"
|
149
|
+
traces[2]['Script'].must_equal "return 1"
|
150
|
+
traces[4]['KVOp'].must_equal "script"
|
151
|
+
traces[4]['subcommand'].must_equal "exists"
|
152
|
+
traces[4]['KVKey'].must_equal @sha
|
153
|
+
traces[6]['KVOp'].must_equal "script"
|
154
|
+
traces[6]['subcommand'].must_equal "exists"
|
155
|
+
traces[6]['KVKey'].must_equal '["e0e1f9fabfc9d4800c877a703b823ac0578ff8db", "other_sha"]'
|
156
|
+
traces[8]['KVOp'].must_equal "script"
|
157
|
+
traces[8]['subcommand'].must_equal "flush"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|