traceview 3.0.2-java → 3.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +39 -14
- data/Gemfile +4 -62
- data/Rakefile +23 -8
- data/gemfiles/frameworks.gemfile +40 -0
- data/gemfiles/libraries.gemfile +78 -0
- data/gemfiles/rails23.gemfile +47 -0
- data/gemfiles/rails30.gemfile +47 -0
- data/gemfiles/rails31.gemfile +47 -0
- data/gemfiles/rails32.gemfile +47 -0
- data/gemfiles/rails40.gemfile +35 -0
- data/gemfiles/rails41.gemfile +35 -0
- data/gemfiles/rails42.gemfile +35 -0
- data/lib/traceview/api/logging.rb +84 -38
- data/lib/traceview/frameworks/rails/inst/action_controller.rb +1 -1
- data/lib/traceview/inst/moped.rb +2 -2
- data/lib/traceview/util.rb +30 -34
- data/lib/traceview/version.rb +1 -1
- data/test/frameworks/apps/grape_nested.rb +3 -0
- data/test/frameworks/apps/grape_simple.rb +3 -0
- data/test/frameworks/apps/sinatra_simple.rb +3 -0
- data/test/frameworks/grape_test.rb +8 -4
- data/test/frameworks/padrino_test.rb +6 -2
- data/test/frameworks/rails2x_test.rb +3 -0
- data/test/frameworks/rails3x_test.rb +91 -0
- data/test/frameworks/rails4x_test.rb +89 -0
- data/test/frameworks/sinatra_test.rb +3 -0
- data/test/instrumentation/cassandra_test.rb +11 -4
- data/test/instrumentation/dalli_test.rb +3 -0
- data/test/instrumentation/em_http_request_test.rb +3 -0
- data/test/instrumentation/excon_test.rb +3 -0
- data/test/instrumentation/faraday_test.rb +3 -0
- data/test/instrumentation/http_test.rb +3 -0
- data/test/instrumentation/httpclient_test.rb +3 -0
- data/test/instrumentation/memcache_test.rb +9 -0
- data/test/instrumentation/memcached_test.rb +3 -0
- data/test/instrumentation/mongo_test.rb +14 -3
- data/test/instrumentation/moped_test.rb +29 -6
- data/test/instrumentation/rack_test.rb +3 -0
- data/test/instrumentation/redis_hashes_test.rb +187 -184
- data/test/instrumentation/redis_keys_test.rb +223 -220
- data/test/instrumentation/redis_lists_test.rb +225 -225
- data/test/instrumentation/redis_misc_test.rb +123 -120
- data/test/instrumentation/redis_sets_test.rb +216 -213
- data/test/instrumentation/redis_sortedsets_test.rb +245 -242
- data/test/instrumentation/redis_strings_test.rb +242 -238
- data/test/instrumentation/resque_test.rb +3 -0
- data/test/instrumentation/rest-client_test.rb +3 -0
- data/test/instrumentation/sequel_mysql2_test.rb +4 -1
- data/test/instrumentation/sequel_mysql_test.rb +4 -1
- data/test/instrumentation/sequel_pg_test.rb +4 -1
- data/test/minitest_helper.rb +25 -8
- data/test/profiling/method_test.rb +3 -0
- data/test/servers/rackapp_8101.rb +1 -1
- data/test/servers/rails2x_8140.rb +2 -2
- data/test/servers/rails3x_8140.rb +78 -0
- data/test/servers/rails4x_8140.rb +78 -0
- data/test/support/backcompat_test.rb +3 -0
- data/test/support/config_test.rb +3 -0
- data/test/support/dnt_test.rb +3 -0
- data/test/support/liboboe_settings_test.rb +3 -0
- data/test/support/tvalias_test.rb +3 -0
- data/test/support/xtrace_test.rb +3 -0
- metadata +19 -5
- data/Appraisals +0 -10
- data/gemfiles/mongo.gemfile +0 -33
- data/gemfiles/moped.gemfile +0 -33
@@ -1,160 +1,163 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
2
|
-
require "redis"
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
if defined?(::Redis)
|
7
|
+
describe "Redis Misc" do
|
8
|
+
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
9
|
|
7
|
-
|
8
|
-
|
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
|
10
14
|
end
|
11
|
-
end
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
before do
|
17
|
+
clear_all_traces
|
15
18
|
|
16
|
-
|
19
|
+
@redis ||= Redis.new
|
17
20
|
|
18
|
-
|
21
|
+
@redis_version ||= @redis.info["redis_version"]
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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)
|
24
30
|
|
25
|
-
|
26
|
-
|
31
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
32
|
+
@redis.publish("channel1", "Broadcasting live from silicon circuits.")
|
33
|
+
end
|
27
34
|
|
28
|
-
|
29
|
-
|
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
|
30
40
|
end
|
31
41
|
|
32
|
-
|
33
|
-
|
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
|
42
|
+
it "should trace select" do
|
43
|
+
min_server_version(2.0)
|
38
44
|
|
39
|
-
|
40
|
-
|
45
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
46
|
+
@redis.select(2)
|
47
|
+
end
|
41
48
|
|
42
|
-
|
43
|
-
|
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
|
44
53
|
end
|
45
54
|
|
46
|
-
|
47
|
-
|
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)
|
55
|
+
it "should trace pipelined operations" do
|
56
|
+
min_server_version(1.2)
|
54
57
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
TraceView::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")
|
60
63
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
@redis.lpush("fringe", "bishop")
|
65
|
+
@redis.lpush("fringe", "dunham")
|
66
|
+
@redis.lpush("fringe", "broyles")
|
67
|
+
end
|
64
68
|
end
|
65
|
-
end
|
66
69
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
72
75
|
|
73
|
-
|
74
|
-
|
76
|
+
it "should trace multi with block" do
|
77
|
+
min_server_version(1.2)
|
75
78
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
TraceView::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")
|
81
84
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
@redis.lpush("hair", "blue")
|
86
|
+
@redis.lpush("hair", "gray")
|
87
|
+
@redis.lpush("hair", "yellow")
|
88
|
+
end
|
85
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"
|
86
95
|
end
|
87
96
|
|
88
|
-
|
89
|
-
|
90
|
-
traces[2]['KVOpCount'].must_equal 8
|
91
|
-
traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
|
92
|
-
end
|
97
|
+
it "should trace eval" do
|
98
|
+
min_server_version(2.6)
|
93
99
|
|
94
|
-
|
95
|
-
|
100
|
+
TraceView::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
|
96
105
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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 }"
|
101
114
|
end
|
102
115
|
|
103
|
-
|
104
|
-
|
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
|
116
|
+
it "should trace evalsha" do
|
117
|
+
min_server_version(2.6)
|
112
118
|
|
113
|
-
|
114
|
-
min_server_version(2.6)
|
119
|
+
sha = @redis.script(:load, "return 1")
|
115
120
|
|
116
|
-
|
121
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
122
|
+
@redis.evalsha(sha)
|
123
|
+
end
|
117
124
|
|
118
|
-
|
119
|
-
|
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
|
120
129
|
end
|
121
130
|
|
122
|
-
|
123
|
-
|
124
|
-
traces[2]['KVOp'].must_equal "evalsha"
|
125
|
-
traces[2]['sha'].must_equal sha
|
126
|
-
end
|
131
|
+
it "should trace script" do
|
132
|
+
min_server_version(2.6)
|
127
133
|
|
128
|
-
|
129
|
-
|
134
|
+
TraceView::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
|
130
140
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
@
|
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"
|
136
161
|
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
162
|
end
|
159
163
|
end
|
160
|
-
|
@@ -1,293 +1,296 @@
|
|
1
|
+
# Copyright (c) 2015 AppNeta, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
1
4
|
require 'minitest_helper'
|
2
|
-
require "redis"
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
if defined?(::Redis)
|
7
|
+
describe "Redis Sets" do
|
8
|
+
attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
|
6
9
|
|
7
|
-
|
8
|
-
|
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
|
10
14
|
end
|
11
|
-
end
|
12
|
-
|
13
|
-
before do
|
14
|
-
clear_all_traces
|
15
15
|
|
16
|
-
|
16
|
+
before do
|
17
|
+
clear_all_traces
|
17
18
|
|
18
|
-
|
19
|
+
@redis ||= Redis.new
|
19
20
|
|
20
|
-
|
21
|
-
@entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
|
22
|
-
@exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should trace sadd" do
|
26
|
-
min_server_version(1.0)
|
21
|
+
@redis_version ||= @redis.info["redis_version"]
|
27
22
|
|
28
|
-
|
29
|
-
@
|
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' }
|
30
26
|
end
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
traces[2]['KVOp'].must_equal "sadd"
|
35
|
-
traces[2]['KVKey'].must_equal "shrimp"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should trace scard" do
|
39
|
-
min_server_version(1.0)
|
28
|
+
it "should trace sadd" do
|
29
|
+
min_server_version(1.0)
|
40
30
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
@redis.sadd("mother sauces", "hollandaise")
|
45
|
-
@redis.sadd("mother sauces", "classic tomate")
|
31
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
32
|
+
@redis.sadd("shrimp", "fried")
|
33
|
+
end
|
46
34
|
|
47
|
-
|
48
|
-
|
35
|
+
traces = get_all_traces
|
36
|
+
traces.count.must_equal 4
|
37
|
+
traces[2]['KVOp'].must_equal "sadd"
|
38
|
+
traces[2]['KVKey'].must_equal "shrimp"
|
49
39
|
end
|
50
40
|
|
51
|
-
|
52
|
-
|
53
|
-
traces[2]['KVOp'].must_equal "scard"
|
54
|
-
traces[2]['KVKey'].must_equal "mother sauces"
|
55
|
-
end
|
41
|
+
it "should trace scard" do
|
42
|
+
min_server_version(1.0)
|
56
43
|
|
57
|
-
|
58
|
-
|
44
|
+
@redis.sadd("mother sauces", "bechamel")
|
45
|
+
@redis.sadd("mother sauces", "veloute")
|
46
|
+
@redis.sadd("mother sauces", "espagnole")
|
47
|
+
@redis.sadd("mother sauces", "hollandaise")
|
48
|
+
@redis.sadd("mother sauces", "classic tomate")
|
59
49
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
@redis.sadd("ab", "a")
|
64
|
-
@redis.sadd("ab", "b")
|
50
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
51
|
+
@redis.scard("mother sauces")
|
52
|
+
end
|
65
53
|
|
66
|
-
|
67
|
-
|
54
|
+
traces = get_all_traces
|
55
|
+
traces.count.must_equal 4
|
56
|
+
traces[2]['KVOp'].must_equal "scard"
|
57
|
+
traces[2]['KVKey'].must_equal "mother sauces"
|
68
58
|
end
|
69
59
|
|
70
|
-
|
71
|
-
|
72
|
-
traces[2]['KVOp'].must_equal "sdiff"
|
73
|
-
traces[2].has_key?('KVKey').must_equal false
|
74
|
-
end
|
60
|
+
it "should trace sdiff" do
|
61
|
+
min_server_version(1.0)
|
75
62
|
|
76
|
-
|
77
|
-
|
63
|
+
@redis.sadd("abc", "a")
|
64
|
+
@redis.sadd("abc", "b")
|
65
|
+
@redis.sadd("abc", "c")
|
66
|
+
@redis.sadd("ab", "a")
|
67
|
+
@redis.sadd("ab", "b")
|
78
68
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
@redis.sadd("ab", "a")
|
83
|
-
@redis.sadd("ab", "b")
|
69
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
70
|
+
@redis.sdiff("abc", "ab")
|
71
|
+
end
|
84
72
|
|
85
|
-
|
86
|
-
|
73
|
+
traces = get_all_traces
|
74
|
+
traces.count.must_equal 4
|
75
|
+
traces[2]['KVOp'].must_equal "sdiff"
|
76
|
+
traces[2].has_key?('KVKey').must_equal false
|
87
77
|
end
|
88
78
|
|
89
|
-
|
90
|
-
|
91
|
-
traces[2]['KVOp'].must_equal "sdiffstore"
|
92
|
-
traces[2]['destination'].must_equal "dest"
|
93
|
-
end
|
79
|
+
it "should trace sdiffstore" do
|
80
|
+
min_server_version(1.0)
|
94
81
|
|
95
|
-
|
96
|
-
|
82
|
+
@redis.sadd("abc", "a")
|
83
|
+
@redis.sadd("abc", "b")
|
84
|
+
@redis.sadd("abc", "c")
|
85
|
+
@redis.sadd("ab", "a")
|
86
|
+
@redis.sadd("ab", "b")
|
97
87
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
@redis.sadd("ab", "a")
|
102
|
-
@redis.sadd("ab", "b")
|
88
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
89
|
+
@redis.sdiffstore("dest", "abc", "ab")
|
90
|
+
end
|
103
91
|
|
104
|
-
|
105
|
-
|
92
|
+
traces = get_all_traces
|
93
|
+
traces.count.must_equal 4
|
94
|
+
traces[2]['KVOp'].must_equal "sdiffstore"
|
95
|
+
traces[2]['destination'].must_equal "dest"
|
106
96
|
end
|
107
97
|
|
108
|
-
|
109
|
-
|
110
|
-
traces[2]['KVOp'].must_equal "sinter"
|
111
|
-
traces[2].has_key?('KVKey').must_equal false
|
112
|
-
end
|
98
|
+
it "should trace sinter" do
|
99
|
+
min_server_version(1.0)
|
113
100
|
|
114
|
-
|
115
|
-
|
101
|
+
@redis.sadd("abc", "a")
|
102
|
+
@redis.sadd("abc", "b")
|
103
|
+
@redis.sadd("abc", "c")
|
104
|
+
@redis.sadd("ab", "a")
|
105
|
+
@redis.sadd("ab", "b")
|
116
106
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
@redis.sadd("ab", "a")
|
121
|
-
@redis.sadd("ab", "b")
|
107
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
108
|
+
@redis.sinter("abc", "ab")
|
109
|
+
end
|
122
110
|
|
123
|
-
|
124
|
-
|
111
|
+
traces = get_all_traces
|
112
|
+
traces.count.must_equal 4
|
113
|
+
traces[2]['KVOp'].must_equal "sinter"
|
114
|
+
traces[2].has_key?('KVKey').must_equal false
|
125
115
|
end
|
126
116
|
|
127
|
-
|
128
|
-
|
129
|
-
traces[2]['KVOp'].must_equal "sinterstore"
|
130
|
-
traces[2]['destination'].must_equal "dest"
|
131
|
-
end
|
117
|
+
it "should trace sinterstore" do
|
118
|
+
min_server_version(1.0)
|
132
119
|
|
133
|
-
|
134
|
-
|
120
|
+
@redis.sadd("abc", "a")
|
121
|
+
@redis.sadd("abc", "b")
|
122
|
+
@redis.sadd("abc", "c")
|
123
|
+
@redis.sadd("ab", "a")
|
124
|
+
@redis.sadd("ab", "b")
|
135
125
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
@redis.sadd("fibonacci", "2")
|
140
|
-
@redis.sadd("fibonacci", "3")
|
141
|
-
@redis.sadd("fibonacci", "5")
|
142
|
-
@redis.sadd("fibonacci", "8")
|
126
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
127
|
+
@redis.sinterstore("dest", "abc", "ab")
|
128
|
+
end
|
143
129
|
|
144
|
-
|
145
|
-
|
130
|
+
traces = get_all_traces
|
131
|
+
traces.count.must_equal 4
|
132
|
+
traces[2]['KVOp'].must_equal "sinterstore"
|
133
|
+
traces[2]['destination'].must_equal "dest"
|
146
134
|
end
|
147
135
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
136
|
+
it "should trace sismember" do
|
137
|
+
min_server_version(1.0)
|
138
|
+
|
139
|
+
@redis.sadd("fibonacci", "0")
|
140
|
+
@redis.sadd("fibonacci", "1")
|
141
|
+
@redis.sadd("fibonacci", "1")
|
142
|
+
@redis.sadd("fibonacci", "2")
|
143
|
+
@redis.sadd("fibonacci", "3")
|
144
|
+
@redis.sadd("fibonacci", "5")
|
145
|
+
@redis.sadd("fibonacci", "8")
|
146
|
+
|
147
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
148
|
+
@redis.sismember("fibonacci", "5")
|
149
|
+
end
|
150
|
+
|
151
|
+
traces = get_all_traces
|
152
|
+
traces.count.must_equal 4
|
153
|
+
traces[2]['KVOp'].must_equal "sismember"
|
154
|
+
traces[2]['KVKey'].must_equal "fibonacci"
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should trace smembers" do
|
158
|
+
min_server_version(1.0)
|
153
159
|
|
154
|
-
|
155
|
-
|
160
|
+
@redis.sadd("fibonacci", "0")
|
161
|
+
@redis.sadd("fibonacci", "1")
|
162
|
+
@redis.sadd("fibonacci", "1")
|
163
|
+
@redis.sadd("fibonacci", "2")
|
164
|
+
@redis.sadd("fibonacci", "3")
|
156
165
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
@redis.sadd("fibonacci", "2")
|
161
|
-
@redis.sadd("fibonacci", "3")
|
166
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
167
|
+
@redis.smembers("fibonacci")
|
168
|
+
end
|
162
169
|
|
163
|
-
|
164
|
-
|
170
|
+
traces = get_all_traces
|
171
|
+
traces.count.must_equal 4
|
172
|
+
traces[2]['KVOp'].must_equal "smembers"
|
173
|
+
traces[2]['KVKey'].must_equal "fibonacci"
|
165
174
|
end
|
166
175
|
|
167
|
-
|
168
|
-
|
169
|
-
traces[2]['KVOp'].must_equal "smembers"
|
170
|
-
traces[2]['KVKey'].must_equal "fibonacci"
|
171
|
-
end
|
176
|
+
it "should trace smove" do
|
177
|
+
min_server_version(1.0)
|
172
178
|
|
173
|
-
|
174
|
-
|
179
|
+
@redis.sadd("numbers", "1")
|
180
|
+
@redis.sadd("numbers", "2")
|
181
|
+
@redis.sadd("alpha", "two")
|
175
182
|
|
176
|
-
|
177
|
-
|
178
|
-
|
183
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
184
|
+
@redis.smove("alpha", "numbers", "two")
|
185
|
+
end
|
179
186
|
|
180
|
-
|
181
|
-
|
187
|
+
traces = get_all_traces
|
188
|
+
traces.count.must_equal 4
|
189
|
+
traces[2]['KVOp'].must_equal "smove"
|
190
|
+
traces[2]['source'].must_equal "alpha"
|
191
|
+
traces[2]['destination'].must_equal "numbers"
|
182
192
|
end
|
183
193
|
|
184
|
-
|
185
|
-
|
186
|
-
traces[2]['KVOp'].must_equal "smove"
|
187
|
-
traces[2]['source'].must_equal "alpha"
|
188
|
-
traces[2]['destination'].must_equal "numbers"
|
189
|
-
end
|
194
|
+
it "should trace spop" do
|
195
|
+
min_server_version(1.0)
|
190
196
|
|
191
|
-
|
192
|
-
|
197
|
+
@redis.sadd("fibonacci", "0")
|
198
|
+
@redis.sadd("fibonacci", "1")
|
199
|
+
@redis.sadd("fibonacci", "1")
|
193
200
|
|
194
|
-
|
195
|
-
|
196
|
-
|
201
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
202
|
+
@redis.spop("fibonacci")
|
203
|
+
end
|
197
204
|
|
198
|
-
|
199
|
-
|
205
|
+
traces = get_all_traces
|
206
|
+
traces.count.must_equal 4
|
207
|
+
traces[2]['KVOp'].must_equal "spop"
|
208
|
+
traces[2]['KVKey'].must_equal "fibonacci"
|
200
209
|
end
|
201
210
|
|
202
|
-
|
203
|
-
|
204
|
-
traces[2]['KVOp'].must_equal "spop"
|
205
|
-
traces[2]['KVKey'].must_equal "fibonacci"
|
206
|
-
end
|
211
|
+
it "should trace srandmember" do
|
212
|
+
min_server_version(1.0)
|
207
213
|
|
208
|
-
|
209
|
-
|
214
|
+
@redis.sadd("fibonacci", "0")
|
215
|
+
@redis.sadd("fibonacci", "1")
|
216
|
+
@redis.sadd("fibonacci", "1")
|
210
217
|
|
211
|
-
|
212
|
-
|
213
|
-
|
218
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
219
|
+
@redis.srandmember("fibonacci")
|
220
|
+
end
|
214
221
|
|
215
|
-
|
216
|
-
|
222
|
+
traces = get_all_traces
|
223
|
+
traces.count.must_equal 4
|
224
|
+
traces[2]['KVOp'].must_equal "srandmember"
|
225
|
+
traces[2]['KVKey'].must_equal "fibonacci"
|
217
226
|
end
|
218
227
|
|
219
|
-
|
220
|
-
|
221
|
-
traces[2]['KVOp'].must_equal "srandmember"
|
222
|
-
traces[2]['KVKey'].must_equal "fibonacci"
|
223
|
-
end
|
228
|
+
it "should trace srem" do
|
229
|
+
min_server_version(1.0)
|
224
230
|
|
225
|
-
|
226
|
-
|
231
|
+
@redis.sadd("fibonacci", "0")
|
232
|
+
@redis.sadd("fibonacci", "1")
|
233
|
+
@redis.sadd("fibonacci", "1")
|
227
234
|
|
228
|
-
|
229
|
-
|
230
|
-
|
235
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
236
|
+
@redis.srem("fibonacci", "0")
|
237
|
+
end
|
231
238
|
|
232
|
-
|
233
|
-
|
239
|
+
traces = get_all_traces
|
240
|
+
traces.count.must_equal 4
|
241
|
+
traces[2]['KVOp'].must_equal "srem"
|
242
|
+
traces[2]['KVKey'].must_equal "fibonacci"
|
234
243
|
end
|
235
244
|
|
236
|
-
|
237
|
-
|
238
|
-
traces[2]['KVOp'].must_equal "srem"
|
239
|
-
traces[2]['KVKey'].must_equal "fibonacci"
|
240
|
-
end
|
245
|
+
it "should trace sunion" do
|
246
|
+
min_server_version(1.0)
|
241
247
|
|
242
|
-
|
243
|
-
|
248
|
+
@redis.sadd("group1", "moe")
|
249
|
+
@redis.sadd("group1", "curly")
|
250
|
+
@redis.sadd("group2", "larry")
|
244
251
|
|
245
|
-
|
246
|
-
|
247
|
-
|
252
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
253
|
+
@redis.sunion("group1", "group2")
|
254
|
+
end
|
248
255
|
|
249
|
-
|
250
|
-
|
256
|
+
traces = get_all_traces
|
257
|
+
traces.count.must_equal 4
|
258
|
+
traces[2]['KVOp'].must_equal "sunion"
|
259
|
+
traces[2].has_key?('KVKey').must_equal false
|
251
260
|
end
|
252
261
|
|
253
|
-
|
254
|
-
|
255
|
-
traces[2]['KVOp'].must_equal "sunion"
|
256
|
-
traces[2].has_key?('KVKey').must_equal false
|
257
|
-
end
|
262
|
+
it "should trace sunionstore" do
|
263
|
+
min_server_version(1.0)
|
258
264
|
|
259
|
-
|
260
|
-
|
265
|
+
@redis.sadd("group1", "moe")
|
266
|
+
@redis.sadd("group1", "curly")
|
267
|
+
@redis.sadd("group2", "larry")
|
261
268
|
|
262
|
-
|
263
|
-
|
264
|
-
|
269
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
270
|
+
@redis.sunionstore("dest", "group1", "group2")
|
271
|
+
end
|
265
272
|
|
266
|
-
|
267
|
-
|
273
|
+
traces = get_all_traces
|
274
|
+
traces.count.must_equal 4
|
275
|
+
traces[2]['KVOp'].must_equal "sunionstore"
|
276
|
+
traces[2]['destination'].must_equal "dest"
|
277
|
+
traces[2].has_key?('KVKey').must_equal false
|
268
278
|
end
|
269
279
|
|
270
|
-
|
271
|
-
|
272
|
-
traces[2]['KVOp'].must_equal "sunionstore"
|
273
|
-
traces[2]['destination'].must_equal "dest"
|
274
|
-
traces[2].has_key?('KVKey').must_equal false
|
275
|
-
end
|
280
|
+
it "should trace sscan" do
|
281
|
+
min_server_version(2.8)
|
276
282
|
|
277
|
-
|
278
|
-
|
283
|
+
@redis.sadd("group1", "moe")
|
284
|
+
@redis.sadd("group1", "curly")
|
279
285
|
|
280
|
-
|
281
|
-
|
286
|
+
TraceView::API.start_trace('redis_test', '', {}) do
|
287
|
+
@redis.sscan("group1", 1)
|
288
|
+
end
|
282
289
|
|
283
|
-
|
284
|
-
|
290
|
+
traces = get_all_traces
|
291
|
+
traces.count.must_equal 4
|
292
|
+
traces[2]['KVOp'].must_equal "sscan"
|
293
|
+
traces[2]['KVKey'].must_equal "group1"
|
285
294
|
end
|
286
|
-
|
287
|
-
traces = get_all_traces
|
288
|
-
traces.count.must_equal 4
|
289
|
-
traces[2]['KVOp'].must_equal "sscan"
|
290
|
-
traces[2]['KVKey'].must_equal "group1"
|
291
295
|
end
|
292
296
|
end
|
293
|
-
|