oboe 2.6.6.1 → 2.6.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Appraisals +6 -16
- data/CHANGELOG.md +30 -14
- data/Gemfile +4 -3
- data/Gemfile.lock +20 -25
- data/Rakefile +5 -1
- data/ext/oboe_metal/extconf.rb +2 -2
- data/gemfiles/mongo.gemfile +33 -0
- data/gemfiles/moped.gemfile +33 -0
- data/lib/base.rb +28 -10
- data/lib/joboe_metal.rb +12 -34
- data/lib/method_profiling.rb +3 -3
- data/lib/oboe/api/layerinit.rb +14 -14
- data/lib/oboe/api/logging.rb +11 -11
- data/lib/oboe/api/profiling.rb +7 -6
- data/lib/oboe/api/tracing.rb +3 -3
- data/lib/oboe/api/util.rb +4 -4
- data/lib/oboe/config.rb +7 -7
- data/lib/oboe/frameworks/padrino.rb +2 -2
- data/lib/oboe/frameworks/rails.rb +11 -11
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +4 -4
- data/lib/oboe/frameworks/rails/inst/action_view.rb +2 -2
- data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/action_view_30.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/active_record.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +3 -3
- data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +2 -2
- data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +8 -8
- data/lib/oboe/frameworks/sinatra.rb +33 -3
- data/lib/oboe/frameworks/sinatra/templates.rb +2 -2
- data/lib/oboe/inst/cassandra.rb +19 -19
- data/lib/oboe/inst/dalli.rb +7 -7
- data/lib/oboe/inst/http.rb +5 -5
- data/lib/oboe/inst/memcache.rb +14 -14
- data/lib/oboe/inst/memcached.rb +8 -8
- data/lib/oboe/inst/mongo.rb +2 -2
- data/lib/oboe/inst/moped.rb +29 -29
- data/lib/oboe/inst/rack.rb +3 -3
- data/lib/oboe/inst/redis.rb +24 -24
- data/lib/oboe/inst/resque.rb +4 -4
- data/lib/oboe/loading.rb +6 -6
- data/lib/oboe/logger.rb +4 -4
- data/lib/oboe/version.rb +1 -1
- data/lib/oboe_metal.rb +11 -39
- data/test/frameworks/apps/grape_simple.rb +1 -1
- data/test/frameworks/apps/sinatra_simple.rb +1 -1
- data/test/frameworks/padrino_test.rb +3 -3
- data/test/frameworks/sinatra_test.rb +3 -3
- data/test/instrumentation/cassandra_test.rb +45 -45
- data/test/instrumentation/http_test.rb +6 -6
- data/test/instrumentation/mongo_test.rb +347 -345
- data/test/instrumentation/moped_test.rb +40 -40
- data/test/instrumentation/redis_hashes_test.rb +20 -20
- data/test/instrumentation/redis_keys_test.rb +19 -19
- data/test/instrumentation/redis_lists_test.rb +22 -22
- data/test/instrumentation/redis_misc_test.rb +14 -14
- data/test/instrumentation/redis_sets_test.rb +20 -20
- data/test/instrumentation/redis_sortedsets_test.rb +25 -25
- data/test/instrumentation/redis_strings_test.rb +27 -27
- data/test/instrumentation/resque_test.rb +7 -7
- data/test/minitest_helper.rb +18 -6
- data/test/profiling/method_test.rb +24 -24
- data/test/support/liboboe_settings_test.rb +3 -3
- data/test/support/xtrace_test.rb +2 -2
- metadata +26 -32
- data/gemfiles/rails2.3.gemfile +0 -18
- data/gemfiles/rails2.3.gemfile.lock +0 -95
- data/gemfiles/rails3.0.gemfile +0 -18
- data/gemfiles/rails3.0.gemfile.lock +0 -142
- data/gemfiles/rails3.1.gemfile +0 -18
- data/gemfiles/rails3.1.gemfile.lock +0 -152
- data/gemfiles/rails3.2.gemfile +0 -18
- data/gemfiles/rails3.2.gemfile.lock +0 -150
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'minitest_helper'
|
2
2
|
|
3
|
-
if RUBY_VERSION >= '1.9.3'
|
3
|
+
if RUBY_VERSION >= '1.9.3' and (defined?(::Moped::VERSION) and ::Moped::VERSION < "2.0")
|
4
4
|
# Moped is tested against MRI 1.9.3, 2.0.0, and JRuby (1.9).
|
5
5
|
|
6
6
|
describe Oboe::Inst::Moped do
|
7
7
|
before do
|
8
|
-
clear_all_traces
|
8
|
+
clear_all_traces
|
9
9
|
@session = Moped::Session.new([ "127.0.0.1:27017" ])
|
10
10
|
@session.use :moped_test
|
11
11
|
@users = @session[:users]
|
@@ -23,13 +23,13 @@ if RUBY_VERSION >= '1.9.3'
|
|
23
23
|
@exit_kvs = { 'Layer' => 'mongo', 'Label' => 'exit' }
|
24
24
|
@collect_backtraces = Oboe::Config[:moped][:collect_backtraces]
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
after do
|
28
28
|
Oboe::Config[:moped][:collect_backtraces] = @collect_backtraces
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'Stock Moped should be loaded, defined and ready' do
|
32
|
-
defined?(::Moped).wont_match nil
|
32
|
+
defined?(::Moped).wont_match nil
|
33
33
|
defined?(::Moped::Database).wont_match nil
|
34
34
|
defined?(::Moped::Indexes).wont_match nil
|
35
35
|
defined?(::Moped::Query).wont_match nil
|
@@ -76,9 +76,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
76
76
|
command[:out] = "inline: 1"
|
77
77
|
@session.command(command)
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
traces = get_all_traces
|
81
|
-
|
81
|
+
|
82
82
|
traces.count.must_equal 4
|
83
83
|
validate_outer_layers(traces, 'moped_test')
|
84
84
|
|
@@ -96,9 +96,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
96
96
|
@users.drop
|
97
97
|
@session.drop
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
traces = get_all_traces
|
101
|
-
|
101
|
+
|
102
102
|
traces.count.must_equal 6
|
103
103
|
validate_outer_layers(traces, 'moped_test')
|
104
104
|
|
@@ -119,9 +119,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
119
119
|
@users.indexes.create({:name => 1}, {:unique => true})
|
120
120
|
@users.indexes.drop
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
traces = get_all_traces
|
124
|
-
|
124
|
+
|
125
125
|
traces.count.must_equal 10
|
126
126
|
validate_outer_layers(traces, 'moped_test')
|
127
127
|
|
@@ -137,13 +137,13 @@ if RUBY_VERSION >= '1.9.3'
|
|
137
137
|
traces[3]['Options'].must_equal "{\"unique\":true}"
|
138
138
|
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
139
139
|
validate_event_keys(traces[4], @exit_kvs)
|
140
|
-
|
140
|
+
|
141
141
|
validate_event_keys(traces[5], @entry_kvs)
|
142
142
|
traces[5]['QueryOp'].must_equal "indexes"
|
143
143
|
traces[5]['Collection'].must_equal "users"
|
144
144
|
traces[5].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
145
145
|
validate_event_keys(traces[6], @exit_kvs)
|
146
|
-
|
146
|
+
|
147
147
|
validate_event_keys(traces[7], @entry_kvs)
|
148
148
|
traces[7]['QueryOp'].must_equal "drop_indexes"
|
149
149
|
traces[7]['Key'].must_equal "all"
|
@@ -155,9 +155,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
155
155
|
Oboe::API.start_trace('moped_test', '', {}) do
|
156
156
|
@users.find.count
|
157
157
|
end
|
158
|
-
|
158
|
+
|
159
159
|
traces = get_all_traces
|
160
|
-
|
160
|
+
|
161
161
|
traces.count.must_equal 6
|
162
162
|
validate_outer_layers(traces, 'moped_test')
|
163
163
|
|
@@ -178,9 +178,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
178
178
|
Oboe::API.start_trace('moped_test', '', {}) do
|
179
179
|
@users.find(:name => "Mary").sort(:city => 1, :created_at => -1)
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
182
|
traces = get_all_traces
|
183
|
-
|
183
|
+
|
184
184
|
traces.count.must_equal 6
|
185
185
|
validate_outer_layers(traces, 'moped_test')
|
186
186
|
|
@@ -198,14 +198,14 @@ if RUBY_VERSION >= '1.9.3'
|
|
198
198
|
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
199
199
|
validate_event_keys(traces[4], @exit_kvs)
|
200
200
|
end
|
201
|
-
|
201
|
+
|
202
202
|
it 'should trace find with limit' do
|
203
203
|
Oboe::API.start_trace('moped_test', '', {}) do
|
204
204
|
@users.find(:name => "Mary").limit(1)
|
205
205
|
end
|
206
|
-
|
206
|
+
|
207
207
|
traces = get_all_traces
|
208
|
-
|
208
|
+
|
209
209
|
traces.count.must_equal 6
|
210
210
|
validate_outer_layers(traces, 'moped_test')
|
211
211
|
|
@@ -228,9 +228,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
228
228
|
Oboe::API.start_trace('moped_test', '', {}) do
|
229
229
|
@users.find(:name => "Mary").distinct(:city)
|
230
230
|
end
|
231
|
-
|
231
|
+
|
232
232
|
traces = get_all_traces
|
233
|
-
|
233
|
+
|
234
234
|
traces.count.must_equal 6
|
235
235
|
validate_outer_layers(traces, 'moped_test')
|
236
236
|
|
@@ -253,9 +253,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
253
253
|
Oboe::API.start_trace('moped_test', '', {}) do
|
254
254
|
@users.find(:name => "Mary").update({:name => "Tool"}, [:multi])
|
255
255
|
end
|
256
|
-
|
256
|
+
|
257
257
|
traces = get_all_traces
|
258
|
-
|
258
|
+
|
259
259
|
traces.count.must_equal 6
|
260
260
|
validate_outer_layers(traces, 'moped_test')
|
261
261
|
|
@@ -279,9 +279,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
279
279
|
Oboe::API.start_trace('moped_test', '', {}) do
|
280
280
|
@users.find(:name => "Mary").update_all({:name => "Tool"})
|
281
281
|
end
|
282
|
-
|
282
|
+
|
283
283
|
traces = get_all_traces
|
284
|
-
|
284
|
+
|
285
285
|
traces.count.must_equal 6
|
286
286
|
validate_outer_layers(traces, 'moped_test')
|
287
287
|
|
@@ -304,9 +304,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
304
304
|
Oboe::API.start_trace('moped_test', '', {}) do
|
305
305
|
@users.find(:name => "Tool").upsert({:name => "Mary"})
|
306
306
|
end
|
307
|
-
|
307
|
+
|
308
308
|
traces = get_all_traces
|
309
|
-
|
309
|
+
|
310
310
|
traces.count.must_equal 6
|
311
311
|
validate_outer_layers(traces, 'moped_test')
|
312
312
|
|
@@ -330,9 +330,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
330
330
|
Oboe::API.start_trace('moped_test', '', {}) do
|
331
331
|
@users.find(:name => "Mary").explain
|
332
332
|
end
|
333
|
-
|
333
|
+
|
334
334
|
traces = get_all_traces
|
335
|
-
|
335
|
+
|
336
336
|
traces.count.must_equal 6
|
337
337
|
validate_outer_layers(traces, 'moped_test')
|
338
338
|
|
@@ -357,9 +357,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
357
357
|
@users.find.modify({:query => { "$inc" => { :likes => 1 }}}, :new => true)
|
358
358
|
@users.find.modify({:query => {}}, :remove => true)
|
359
359
|
end
|
360
|
-
|
360
|
+
|
361
361
|
traces = get_all_traces
|
362
|
-
|
362
|
+
|
363
363
|
traces.count.must_equal 14
|
364
364
|
validate_outer_layers(traces, 'moped_test')
|
365
365
|
|
@@ -377,7 +377,7 @@ if RUBY_VERSION >= '1.9.3'
|
|
377
377
|
traces[3]['Options'].must_equal "{\"upsert\":true}"
|
378
378
|
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
379
379
|
validate_event_keys(traces[4], @exit_kvs)
|
380
|
-
|
380
|
+
|
381
381
|
validate_event_keys(traces[7], @entry_kvs)
|
382
382
|
traces[7]['QueryOp'].must_equal "modify"
|
383
383
|
traces[7]['Update_Document'].must_equal "all"
|
@@ -386,7 +386,7 @@ if RUBY_VERSION >= '1.9.3'
|
|
386
386
|
traces[7]['Change'].must_equal "{\"query\":{\"$inc\":{\"likes\":1}}}"
|
387
387
|
traces[7].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
388
388
|
validate_event_keys(traces[8], @exit_kvs)
|
389
|
-
|
389
|
+
|
390
390
|
validate_event_keys(traces[11], @entry_kvs)
|
391
391
|
traces[11]['Collection'].must_equal "users"
|
392
392
|
traces[11]['QueryOp'].must_equal "modify"
|
@@ -401,9 +401,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
401
401
|
Oboe::API.start_trace('moped_test', '', {}) do
|
402
402
|
@users.find(:name => "Tool").remove
|
403
403
|
end
|
404
|
-
|
404
|
+
|
405
405
|
traces = get_all_traces
|
406
|
-
|
406
|
+
|
407
407
|
traces.count.must_equal 6
|
408
408
|
validate_outer_layers(traces, 'moped_test')
|
409
409
|
|
@@ -426,9 +426,9 @@ if RUBY_VERSION >= '1.9.3'
|
|
426
426
|
Oboe::API.start_trace('moped_test', '', {}) do
|
427
427
|
@users.find(:name => "Mary").remove_all
|
428
428
|
end
|
429
|
-
|
429
|
+
|
430
430
|
traces = get_all_traces
|
431
|
-
|
431
|
+
|
432
432
|
traces.count.must_equal 6
|
433
433
|
validate_outer_layers(traces, 'moped_test')
|
434
434
|
|
@@ -446,10 +446,10 @@ if RUBY_VERSION >= '1.9.3'
|
|
446
446
|
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
447
447
|
validate_event_keys(traces[4], @exit_kvs)
|
448
448
|
end
|
449
|
-
|
449
|
+
|
450
450
|
it "should obey :collect_backtraces setting when true" do
|
451
451
|
Oboe::Config[:moped][:collect_backtraces] = true
|
452
|
-
|
452
|
+
|
453
453
|
Oboe::API.start_trace('moped_test', '', {}) do
|
454
454
|
@users.find(:name => "Mary").limit(1)
|
455
455
|
end
|
@@ -460,7 +460,7 @@ if RUBY_VERSION >= '1.9.3'
|
|
460
460
|
|
461
461
|
it "should obey :collect_backtraces setting when false" do
|
462
462
|
Oboe::Config[:moped][:collect_backtraces] = false
|
463
|
-
|
463
|
+
|
464
464
|
Oboe::API.start_trace('moped_test', '', {}) do
|
465
465
|
@users.find(:name => "Mary").limit(1)
|
466
466
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'minitest_helper'
|
2
2
|
require "redis"
|
3
|
-
|
3
|
+
|
4
4
|
describe Oboe::Inst::Redis, :hashes do
|
5
5
|
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
6
|
|
7
7
|
def min_server_version(version)
|
8
8
|
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
9
|
-
skip "supported only on redis-server #{version} or greater"
|
9
|
+
skip "supported only on redis-server #{version} or greater"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
before do
|
14
|
-
clear_all_traces
|
15
|
-
|
14
|
+
clear_all_traces
|
15
|
+
|
16
16
|
@redis ||= Redis.new
|
17
17
|
|
18
18
|
@redis_version ||= @redis.info["redis_version"]
|
@@ -23,9 +23,9 @@ describe Oboe::Inst::Redis, :hashes do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'Stock Redis should be loaded, defined and ready' do
|
26
|
-
defined?(::Redis).wont_match nil
|
26
|
+
defined?(::Redis).wont_match nil
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should trace hdel" do
|
30
30
|
min_server_version(2.0)
|
31
31
|
|
@@ -41,7 +41,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
41
41
|
traces[2]['KVKey'].must_equal "whale"
|
42
42
|
traces[2]['field'].must_equal "color"
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should trace hdel multiple fields" do
|
46
46
|
min_server_version(2.4)
|
47
47
|
|
@@ -59,7 +59,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
59
59
|
traces[2]['KVKey'].must_equal "whale"
|
60
60
|
traces[2].has_key?('field').must_equal false
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
it "should trace hexists" do
|
64
64
|
min_server_version(2.0)
|
65
65
|
|
@@ -75,7 +75,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
75
75
|
traces[2]['KVKey'].must_equal "whale"
|
76
76
|
traces[2]['field'].must_equal "color"
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
it "should trace hget" do
|
80
80
|
min_server_version(2.0)
|
81
81
|
|
@@ -94,7 +94,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
94
94
|
traces[2]['field'].must_equal "color"
|
95
95
|
traces[4]['KVHit'].must_equal "0"
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "should trace hgetall" do
|
99
99
|
min_server_version(2.0)
|
100
100
|
|
@@ -109,7 +109,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
109
109
|
traces[2]['KVOp'].must_equal "hgetall"
|
110
110
|
traces[2]['KVKey'].must_equal "whale"
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
it "should trace hincrby" do
|
114
114
|
min_server_version(2.0)
|
115
115
|
|
@@ -126,7 +126,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
126
126
|
traces[2]['field'].must_equal "age"
|
127
127
|
traces[2]['increment'].must_equal "1"
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
it "should trace hincrbyfloat" do
|
131
131
|
min_server_version(2.6)
|
132
132
|
|
@@ -143,7 +143,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
143
143
|
traces[2]['field'].must_equal "age"
|
144
144
|
traces[2]['increment'].must_equal "1.3"
|
145
145
|
end
|
146
|
-
|
146
|
+
|
147
147
|
it "should trace hkeys" do
|
148
148
|
min_server_version(2.0)
|
149
149
|
|
@@ -158,7 +158,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
158
158
|
traces[2]['KVOp'].must_equal "hkeys"
|
159
159
|
traces[2]['KVKey'].must_equal "whale"
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
it "should trace hlen" do
|
163
163
|
min_server_version(2.0)
|
164
164
|
|
@@ -173,7 +173,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
173
173
|
traces[2]['KVOp'].must_equal "hlen"
|
174
174
|
traces[2]['KVKey'].must_equal "whale"
|
175
175
|
end
|
176
|
-
|
176
|
+
|
177
177
|
it "should trace hmget" do
|
178
178
|
min_server_version(2.0)
|
179
179
|
|
@@ -192,7 +192,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
192
192
|
traces[2]['KVKeyCount'].must_equal "4"
|
193
193
|
traces[2]['KVHitCount'].must_equal "2"
|
194
194
|
end
|
195
|
-
|
195
|
+
|
196
196
|
it "should trace hmset" do
|
197
197
|
min_server_version(2.0)
|
198
198
|
|
@@ -209,7 +209,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
209
209
|
traces[2]['KVOp'].must_equal "hmset"
|
210
210
|
traces[2]['KVKey'].must_equal "whale"
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
it "should trace hset" do
|
214
214
|
min_server_version(2.0)
|
215
215
|
|
@@ -222,7 +222,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
222
222
|
traces[2]['KVOp'].must_equal "hset"
|
223
223
|
traces[2]['KVKey'].must_equal "whale"
|
224
224
|
end
|
225
|
-
|
225
|
+
|
226
226
|
it "should trace hsetnx" do
|
227
227
|
min_server_version(2.0)
|
228
228
|
|
@@ -235,7 +235,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
235
235
|
traces[2]['KVOp'].must_equal "hsetnx"
|
236
236
|
traces[2]['KVKey'].must_equal "whale"
|
237
237
|
end
|
238
|
-
|
238
|
+
|
239
239
|
it "should trace hvals" do
|
240
240
|
min_server_version(2.0)
|
241
241
|
|
@@ -248,7 +248,7 @@ describe Oboe::Inst::Redis, :hashes do
|
|
248
248
|
traces[2]['KVOp'].must_equal "hvals"
|
249
249
|
traces[2]['KVKey'].must_equal "whale"
|
250
250
|
end
|
251
|
-
|
251
|
+
|
252
252
|
it "should trace hscan" do
|
253
253
|
min_server_version(2.8)
|
254
254
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'minitest_helper'
|
2
2
|
require "redis"
|
3
|
-
|
3
|
+
|
4
4
|
describe Oboe::Inst::Redis, :keys do
|
5
5
|
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
6
|
|
7
7
|
def min_server_version(version)
|
8
8
|
unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
|
9
|
-
skip "supported only on redis-server #{version} or greater"
|
9
|
+
skip "supported only on redis-server #{version} or greater"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
before do
|
14
|
-
clear_all_traces
|
15
|
-
|
14
|
+
clear_all_traces
|
15
|
+
|
16
16
|
@redis ||= Redis.new
|
17
17
|
|
18
18
|
@redis_version ||= @redis.info["redis_version"]
|
@@ -23,9 +23,9 @@ describe Oboe::Inst::Redis, :keys do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'Stock Redis should be loaded, defined and ready' do
|
26
|
-
defined?(::Redis).wont_match nil
|
26
|
+
defined?(::Redis).wont_match nil
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should trace del" do
|
30
30
|
@redis.setex("del_test", 60, "blah")
|
31
31
|
|
@@ -38,7 +38,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
38
38
|
traces[2]['KVOp'].must_equal "del"
|
39
39
|
traces[2]['KVKey'].must_equal "del_test"
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
it "should trace del of multiple keys" do
|
43
43
|
@redis.setex("del_test", 60, "blah")
|
44
44
|
|
@@ -81,7 +81,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
81
81
|
traces[2]['KVOp'].must_equal "exists"
|
82
82
|
traces[2]['KVKey'].must_equal "talking_heads"
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it "should trace expire" do
|
86
86
|
@redis.set("expire_please", "burning down the house")
|
87
87
|
|
@@ -94,7 +94,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
94
94
|
traces[2]['KVOp'].must_equal "expire"
|
95
95
|
traces[2]['KVKey'].must_equal "expire_please"
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
it "should trace expireat" do
|
99
99
|
@redis.set("expireat_please", "burning down the house")
|
100
100
|
|
@@ -107,7 +107,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
107
107
|
traces[2]['KVOp'].must_equal "expireat"
|
108
108
|
traces[2]['KVKey'].must_equal "expireat_please"
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
it "should trace keys" do
|
112
112
|
Oboe::API.start_trace('redis_test', '', {}) do
|
113
113
|
@redis.keys("del*")
|
@@ -118,7 +118,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
118
118
|
traces[2]['KVOp'].must_equal "keys"
|
119
119
|
traces[2]['pattern'].must_equal "del*"
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
it "should trace basic move" do
|
123
123
|
@redis.set("piano", Time.now)
|
124
124
|
|
@@ -132,7 +132,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
132
132
|
traces[2]['KVKey'].must_equal "piano"
|
133
133
|
traces[2]['db'].must_equal "1"
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
it "should trace persist" do
|
137
137
|
min_server_version(2.2)
|
138
138
|
|
@@ -147,7 +147,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
147
147
|
traces[2]['KVOp'].must_equal "persist"
|
148
148
|
traces[2]['KVKey'].must_equal "mine"
|
149
149
|
end
|
150
|
-
|
150
|
+
|
151
151
|
it "should trace pexpire" do
|
152
152
|
min_server_version(2.6)
|
153
153
|
|
@@ -174,7 +174,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
174
174
|
Oboe::API.start_trace('redis_test', '', {}) do
|
175
175
|
@rv = @redis.pexpireat("sand", 8000)
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
@rv.must_equal true
|
179
179
|
|
180
180
|
traces = get_all_traces
|
@@ -198,7 +198,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
198
198
|
traces[2]['KVOp'].must_equal "pttl"
|
199
199
|
traces[2]['KVKey'].must_equal "sand"
|
200
200
|
end
|
201
|
-
|
201
|
+
|
202
202
|
it "should trace randomkey" do
|
203
203
|
Oboe::API.start_trace('redis_test', '', {}) do
|
204
204
|
@redis.randomkey()
|
@@ -254,7 +254,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
254
254
|
traces[2]['KVKey'].must_equal "blue"
|
255
255
|
traces[2]['ttl'].must_equal "0"
|
256
256
|
end
|
257
|
-
|
257
|
+
|
258
258
|
it "should trace sort" do
|
259
259
|
min_server_version(2.2)
|
260
260
|
|
@@ -272,7 +272,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
272
272
|
traces[2]['KVOp'].must_equal "sort"
|
273
273
|
traces[2]['KVKey'].must_equal "penguin"
|
274
274
|
end
|
275
|
-
|
275
|
+
|
276
276
|
it "should trace ttl" do
|
277
277
|
min_server_version(2.6)
|
278
278
|
|
@@ -287,7 +287,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
287
287
|
traces[2]['KVOp'].must_equal "ttl"
|
288
288
|
traces[2]['KVKey'].must_equal "sand"
|
289
289
|
end
|
290
|
-
|
290
|
+
|
291
291
|
it "should trace type" do
|
292
292
|
min_server_version(2.6)
|
293
293
|
|
@@ -302,7 +302,7 @@ describe Oboe::Inst::Redis, :keys do
|
|
302
302
|
traces[2]['KVOp'].must_equal "type"
|
303
303
|
traces[2]['KVKey'].must_equal "sand"
|
304
304
|
end
|
305
|
-
|
305
|
+
|
306
306
|
it "should trace scan" do
|
307
307
|
min_server_version(2.8)
|
308
308
|
|