oboe 2.7.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.travis.yml +51 -0
  4. data/Appraisals +10 -0
  5. data/CHANGELOG.md +223 -0
  6. data/Gemfile +49 -0
  7. data/LICENSE +199 -0
  8. data/README.md +380 -0
  9. data/Rakefile +106 -0
  10. data/ext/oboe_metal/extconf.rb +61 -0
  11. data/ext/oboe_metal/noop/noop.c +7 -0
  12. data/ext/oboe_metal/src/bson/bson.h +221 -0
  13. data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
  14. data/ext/oboe_metal/src/oboe.h +275 -0
  15. data/ext/oboe_metal/src/oboe.hpp +352 -0
  16. data/ext/oboe_metal/src/oboe_wrap.cxx +3886 -0
  17. data/ext/oboe_metal/tests/test.rb +11 -0
  18. data/gemfiles/mongo.gemfile +33 -0
  19. data/gemfiles/moped.gemfile +33 -0
  20. data/get_version.rb +5 -0
  21. data/init.rb +4 -0
  22. data/lib/base.rb +99 -0
  23. data/lib/joboe_metal.rb +185 -0
  24. data/lib/method_profiling.rb +70 -0
  25. data/lib/oboe.rb +50 -0
  26. data/lib/oboe/api.rb +14 -0
  27. data/lib/oboe/api/layerinit.rb +99 -0
  28. data/lib/oboe/api/logging.rb +129 -0
  29. data/lib/oboe/api/memcache.rb +29 -0
  30. data/lib/oboe/api/profiling.rb +50 -0
  31. data/lib/oboe/api/tracing.rb +134 -0
  32. data/lib/oboe/api/util.rb +117 -0
  33. data/lib/oboe/config.rb +140 -0
  34. data/lib/oboe/frameworks/grape.rb +74 -0
  35. data/lib/oboe/frameworks/padrino.rb +66 -0
  36. data/lib/oboe/frameworks/padrino/templates.rb +59 -0
  37. data/lib/oboe/frameworks/rails.rb +139 -0
  38. data/lib/oboe/frameworks/rails/helpers/rum/rum_ajax_header.js.erb +5 -0
  39. data/lib/oboe/frameworks/rails/helpers/rum/rum_footer.js.erb +1 -0
  40. data/lib/oboe/frameworks/rails/helpers/rum/rum_header.js.erb +3 -0
  41. data/lib/oboe/frameworks/rails/inst/action_controller.rb +123 -0
  42. data/lib/oboe/frameworks/rails/inst/action_view.rb +56 -0
  43. data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +54 -0
  44. data/lib/oboe/frameworks/rails/inst/action_view_30.rb +48 -0
  45. data/lib/oboe/frameworks/rails/inst/active_record.rb +24 -0
  46. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
  47. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +28 -0
  48. data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +18 -0
  49. data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +30 -0
  50. data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +118 -0
  51. data/lib/oboe/frameworks/sinatra.rb +96 -0
  52. data/lib/oboe/frameworks/sinatra/templates.rb +56 -0
  53. data/lib/oboe/inst/cassandra.rb +281 -0
  54. data/lib/oboe/inst/dalli.rb +75 -0
  55. data/lib/oboe/inst/http.rb +72 -0
  56. data/lib/oboe/inst/memcache.rb +105 -0
  57. data/lib/oboe/inst/memcached.rb +96 -0
  58. data/lib/oboe/inst/mongo.rb +240 -0
  59. data/lib/oboe/inst/moped.rb +474 -0
  60. data/lib/oboe/inst/rack.rb +81 -0
  61. data/lib/oboe/inst/redis.rb +273 -0
  62. data/lib/oboe/inst/resque.rb +193 -0
  63. data/lib/oboe/instrumentation.rb +18 -0
  64. data/lib/oboe/loading.rb +98 -0
  65. data/lib/oboe/logger.rb +41 -0
  66. data/lib/oboe/ruby.rb +11 -0
  67. data/lib/oboe/util.rb +129 -0
  68. data/lib/oboe/version.rb +13 -0
  69. data/lib/oboe/xtrace.rb +52 -0
  70. data/lib/oboe_metal.rb +140 -0
  71. data/lib/rails/generators/oboe/install_generator.rb +76 -0
  72. data/lib/rails/generators/oboe/templates/oboe_initializer.rb +94 -0
  73. data/oboe.gemspec +29 -0
  74. data/release.sh +65 -0
  75. data/test/frameworks/apps/grape_simple.rb +10 -0
  76. data/test/frameworks/apps/padrino_simple.rb +41 -0
  77. data/test/frameworks/apps/sinatra_simple.rb +20 -0
  78. data/test/frameworks/grape_test.rb +27 -0
  79. data/test/frameworks/padrino_test.rb +25 -0
  80. data/test/frameworks/sinatra_test.rb +25 -0
  81. data/test/instrumentation/cassandra_test.rb +381 -0
  82. data/test/instrumentation/dalli_test.rb +164 -0
  83. data/test/instrumentation/http_test.rb +97 -0
  84. data/test/instrumentation/memcache_test.rb +251 -0
  85. data/test/instrumentation/memcached_test.rb +226 -0
  86. data/test/instrumentation/mongo_test.rb +462 -0
  87. data/test/instrumentation/moped_test.rb +473 -0
  88. data/test/instrumentation/rack_test.rb +73 -0
  89. data/test/instrumentation/redis_hashes_test.rb +265 -0
  90. data/test/instrumentation/redis_keys_test.rb +318 -0
  91. data/test/instrumentation/redis_lists_test.rb +310 -0
  92. data/test/instrumentation/redis_misc_test.rb +160 -0
  93. data/test/instrumentation/redis_sets_test.rb +293 -0
  94. data/test/instrumentation/redis_sortedsets_test.rb +325 -0
  95. data/test/instrumentation/redis_strings_test.rb +333 -0
  96. data/test/instrumentation/resque_test.rb +62 -0
  97. data/test/minitest_helper.rb +148 -0
  98. data/test/profiling/method_test.rb +198 -0
  99. data/test/support/config_test.rb +39 -0
  100. data/test/support/liboboe_settings_test.rb +46 -0
  101. data/test/support/xtrace_test.rb +35 -0
  102. metadata +200 -0
@@ -0,0 +1,293 @@
1
+ require 'minitest_helper'
2
+ require "redis"
3
+
4
+ describe Oboe::Inst::Redis, :sets 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 sadd" do
26
+ min_server_version(1.0)
27
+
28
+ Oboe::API.start_trace('redis_test', '', {}) do
29
+ @redis.sadd("shrimp", "fried")
30
+ end
31
+
32
+ traces = get_all_traces
33
+ traces.count.must_equal 4
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)
40
+
41
+ @redis.sadd("mother sauces", "bechamel")
42
+ @redis.sadd("mother sauces", "veloute")
43
+ @redis.sadd("mother sauces", "espagnole")
44
+ @redis.sadd("mother sauces", "hollandaise")
45
+ @redis.sadd("mother sauces", "classic tomate")
46
+
47
+ Oboe::API.start_trace('redis_test', '', {}) do
48
+ @redis.scard("mother sauces")
49
+ end
50
+
51
+ traces = get_all_traces
52
+ traces.count.must_equal 4
53
+ traces[2]['KVOp'].must_equal "scard"
54
+ traces[2]['KVKey'].must_equal "mother sauces"
55
+ end
56
+
57
+ it "should trace sdiff" do
58
+ min_server_version(1.0)
59
+
60
+ @redis.sadd("abc", "a")
61
+ @redis.sadd("abc", "b")
62
+ @redis.sadd("abc", "c")
63
+ @redis.sadd("ab", "a")
64
+ @redis.sadd("ab", "b")
65
+
66
+ Oboe::API.start_trace('redis_test', '', {}) do
67
+ @redis.sdiff("abc", "ab")
68
+ end
69
+
70
+ traces = get_all_traces
71
+ traces.count.must_equal 4
72
+ traces[2]['KVOp'].must_equal "sdiff"
73
+ traces[2].has_key?('KVKey').must_equal false
74
+ end
75
+
76
+ it "should trace sdiffstore" do
77
+ min_server_version(1.0)
78
+
79
+ @redis.sadd("abc", "a")
80
+ @redis.sadd("abc", "b")
81
+ @redis.sadd("abc", "c")
82
+ @redis.sadd("ab", "a")
83
+ @redis.sadd("ab", "b")
84
+
85
+ Oboe::API.start_trace('redis_test', '', {}) do
86
+ @redis.sdiffstore("dest", "abc", "ab")
87
+ end
88
+
89
+ traces = get_all_traces
90
+ traces.count.must_equal 4
91
+ traces[2]['KVOp'].must_equal "sdiffstore"
92
+ traces[2]['destination'].must_equal "dest"
93
+ end
94
+
95
+ it "should trace sinter" do
96
+ min_server_version(1.0)
97
+
98
+ @redis.sadd("abc", "a")
99
+ @redis.sadd("abc", "b")
100
+ @redis.sadd("abc", "c")
101
+ @redis.sadd("ab", "a")
102
+ @redis.sadd("ab", "b")
103
+
104
+ Oboe::API.start_trace('redis_test', '', {}) do
105
+ @redis.sinter("abc", "ab")
106
+ end
107
+
108
+ traces = get_all_traces
109
+ traces.count.must_equal 4
110
+ traces[2]['KVOp'].must_equal "sinter"
111
+ traces[2].has_key?('KVKey').must_equal false
112
+ end
113
+
114
+ it "should trace sinterstore" do
115
+ min_server_version(1.0)
116
+
117
+ @redis.sadd("abc", "a")
118
+ @redis.sadd("abc", "b")
119
+ @redis.sadd("abc", "c")
120
+ @redis.sadd("ab", "a")
121
+ @redis.sadd("ab", "b")
122
+
123
+ Oboe::API.start_trace('redis_test', '', {}) do
124
+ @redis.sinterstore("dest", "abc", "ab")
125
+ end
126
+
127
+ traces = get_all_traces
128
+ traces.count.must_equal 4
129
+ traces[2]['KVOp'].must_equal "sinterstore"
130
+ traces[2]['destination'].must_equal "dest"
131
+ end
132
+
133
+ it "should trace sismember" do
134
+ min_server_version(1.0)
135
+
136
+ @redis.sadd("fibonacci", "0")
137
+ @redis.sadd("fibonacci", "1")
138
+ @redis.sadd("fibonacci", "1")
139
+ @redis.sadd("fibonacci", "2")
140
+ @redis.sadd("fibonacci", "3")
141
+ @redis.sadd("fibonacci", "5")
142
+ @redis.sadd("fibonacci", "8")
143
+
144
+ Oboe::API.start_trace('redis_test', '', {}) do
145
+ @redis.sismember("fibonacci", "5")
146
+ end
147
+
148
+ traces = get_all_traces
149
+ traces.count.must_equal 4
150
+ traces[2]['KVOp'].must_equal "sismember"
151
+ traces[2]['KVKey'].must_equal "fibonacci"
152
+ end
153
+
154
+ it "should trace smembers" do
155
+ min_server_version(1.0)
156
+
157
+ @redis.sadd("fibonacci", "0")
158
+ @redis.sadd("fibonacci", "1")
159
+ @redis.sadd("fibonacci", "1")
160
+ @redis.sadd("fibonacci", "2")
161
+ @redis.sadd("fibonacci", "3")
162
+
163
+ Oboe::API.start_trace('redis_test', '', {}) do
164
+ @redis.smembers("fibonacci")
165
+ end
166
+
167
+ traces = get_all_traces
168
+ traces.count.must_equal 4
169
+ traces[2]['KVOp'].must_equal "smembers"
170
+ traces[2]['KVKey'].must_equal "fibonacci"
171
+ end
172
+
173
+ it "should trace smove" do
174
+ min_server_version(1.0)
175
+
176
+ @redis.sadd("numbers", "1")
177
+ @redis.sadd("numbers", "2")
178
+ @redis.sadd("alpha", "two")
179
+
180
+ Oboe::API.start_trace('redis_test', '', {}) do
181
+ @redis.smove("alpha", "numbers", "two")
182
+ end
183
+
184
+ traces = get_all_traces
185
+ traces.count.must_equal 4
186
+ traces[2]['KVOp'].must_equal "smove"
187
+ traces[2]['source'].must_equal "alpha"
188
+ traces[2]['destination'].must_equal "numbers"
189
+ end
190
+
191
+ it "should trace spop" do
192
+ min_server_version(1.0)
193
+
194
+ @redis.sadd("fibonacci", "0")
195
+ @redis.sadd("fibonacci", "1")
196
+ @redis.sadd("fibonacci", "1")
197
+
198
+ Oboe::API.start_trace('redis_test', '', {}) do
199
+ @redis.spop("fibonacci")
200
+ end
201
+
202
+ traces = get_all_traces
203
+ traces.count.must_equal 4
204
+ traces[2]['KVOp'].must_equal "spop"
205
+ traces[2]['KVKey'].must_equal "fibonacci"
206
+ end
207
+
208
+ it "should trace srandmember" do
209
+ min_server_version(1.0)
210
+
211
+ @redis.sadd("fibonacci", "0")
212
+ @redis.sadd("fibonacci", "1")
213
+ @redis.sadd("fibonacci", "1")
214
+
215
+ Oboe::API.start_trace('redis_test', '', {}) do
216
+ @redis.srandmember("fibonacci")
217
+ end
218
+
219
+ traces = get_all_traces
220
+ traces.count.must_equal 4
221
+ traces[2]['KVOp'].must_equal "srandmember"
222
+ traces[2]['KVKey'].must_equal "fibonacci"
223
+ end
224
+
225
+ it "should trace srem" do
226
+ min_server_version(1.0)
227
+
228
+ @redis.sadd("fibonacci", "0")
229
+ @redis.sadd("fibonacci", "1")
230
+ @redis.sadd("fibonacci", "1")
231
+
232
+ Oboe::API.start_trace('redis_test', '', {}) do
233
+ @redis.srem("fibonacci", "0")
234
+ end
235
+
236
+ traces = get_all_traces
237
+ traces.count.must_equal 4
238
+ traces[2]['KVOp'].must_equal "srem"
239
+ traces[2]['KVKey'].must_equal "fibonacci"
240
+ end
241
+
242
+ it "should trace sunion" do
243
+ min_server_version(1.0)
244
+
245
+ @redis.sadd("group1", "moe")
246
+ @redis.sadd("group1", "curly")
247
+ @redis.sadd("group2", "larry")
248
+
249
+ Oboe::API.start_trace('redis_test', '', {}) do
250
+ @redis.sunion("group1", "group2")
251
+ end
252
+
253
+ traces = get_all_traces
254
+ traces.count.must_equal 4
255
+ traces[2]['KVOp'].must_equal "sunion"
256
+ traces[2].has_key?('KVKey').must_equal false
257
+ end
258
+
259
+ it "should trace sunionstore" do
260
+ min_server_version(1.0)
261
+
262
+ @redis.sadd("group1", "moe")
263
+ @redis.sadd("group1", "curly")
264
+ @redis.sadd("group2", "larry")
265
+
266
+ Oboe::API.start_trace('redis_test', '', {}) do
267
+ @redis.sunionstore("dest", "group1", "group2")
268
+ end
269
+
270
+ traces = get_all_traces
271
+ traces.count.must_equal 4
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
276
+
277
+ it "should trace sscan" do
278
+ min_server_version(2.8)
279
+
280
+ @redis.sadd("group1", "moe")
281
+ @redis.sadd("group1", "curly")
282
+
283
+ Oboe::API.start_trace('redis_test', '', {}) do
284
+ @redis.sscan("group1", 1)
285
+ 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
+ end
292
+ end
293
+
@@ -0,0 +1,325 @@
1
+ require 'minitest_helper'
2
+ require "redis"
3
+
4
+ describe Oboe::Inst::Redis, :sortedsets 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 zadd" do
26
+ min_server_version(1.2)
27
+
28
+ Oboe::API.start_trace('redis_test', '', {}) do
29
+ @redis.zadd("time", 0, "past")
30
+ end
31
+
32
+ traces = get_all_traces
33
+ traces.count.must_equal 4
34
+ traces[2]['KVOp'].must_equal "zadd"
35
+ traces[2]['KVKey'].must_equal "time"
36
+ end
37
+
38
+ it "should trace zcard" do
39
+ min_server_version(1.2)
40
+
41
+ @redis.zadd("sauce", 0, "bechamel")
42
+ @redis.zadd("sauce", 1, "veloute")
43
+ @redis.zadd("sauce", 2, "espagnole")
44
+ @redis.zadd("sauce", 3, "hollandaise")
45
+ @redis.zadd("sauce", 4, "classic tomate")
46
+
47
+ Oboe::API.start_trace('redis_test', '', {}) do
48
+ @redis.zcard("sauce")
49
+ end
50
+
51
+ traces = get_all_traces
52
+ traces.count.must_equal 4
53
+ traces[2]['KVOp'].must_equal "zcard"
54
+ traces[2]['KVKey'].must_equal "sauce"
55
+ end
56
+
57
+ it "should trace zcount" do
58
+ min_server_version(2.0)
59
+
60
+ @redis.zadd("sauce", 0, "bechamel")
61
+ @redis.zadd("sauce", 1, "veloute")
62
+ @redis.zadd("sauce", 2, "espagnole")
63
+ @redis.zadd("sauce", 3, "hollandaise")
64
+ @redis.zadd("sauce", 4, "classic tomate")
65
+
66
+ Oboe::API.start_trace('redis_test', '', {}) do
67
+ @redis.zcount("sauce", 1, 3)
68
+ end
69
+
70
+ traces = get_all_traces
71
+ traces.count.must_equal 4
72
+ traces[2]['KVOp'].must_equal "zcount"
73
+ traces[2]['KVKey'].must_equal "sauce"
74
+ end
75
+
76
+ it "should trace zincrby" do
77
+ min_server_version(1.2)
78
+
79
+ @redis.zadd("sauce", 0, "bechamel")
80
+ @redis.zadd("sauce", 1, "veloute")
81
+ @redis.zadd("sauce", 2, "espagnole")
82
+ @redis.zadd("sauce", 3, "hollandaise")
83
+ @redis.zadd("sauce", 4, "classic tomate")
84
+
85
+ Oboe::API.start_trace('redis_test', '', {}) do
86
+ @redis.zincrby("sauce", 1, "veloute")
87
+ end
88
+
89
+ traces = get_all_traces
90
+ traces.count.must_equal 4
91
+ traces[2]['KVOp'].must_equal "zincrby"
92
+ traces[2]['KVKey'].must_equal "sauce"
93
+ end
94
+
95
+ it "should trace zinterstore" do
96
+ min_server_version(2.0)
97
+
98
+ @redis.zadd("sauce", 0, "bechamel")
99
+ @redis.zadd("sauce", 1, "veloute")
100
+ @redis.zadd("sauce", 2, "espagnole")
101
+
102
+ @redis.zadd("beverage", 0, "milkshake")
103
+ @redis.zadd("beverage", 1, "soda")
104
+
105
+ Oboe::API.start_trace('redis_test', '', {}) do
106
+ @redis.zinterstore("zinterstore_dest", [ "sauce", "beverage" ], :weights => [2, 3])
107
+ end
108
+
109
+ traces = get_all_traces
110
+ traces.count.must_equal 4
111
+ traces[2]['KVOp'].must_equal "zinterstore"
112
+ traces[2]['destination'].must_equal "zinterstore_dest"
113
+ traces[2].has_key?('KVKey').must_equal false
114
+ end
115
+
116
+ it "should trace zrange" do
117
+ min_server_version(1.2)
118
+
119
+ @redis.zadd("sauce", 0, "bechamel")
120
+ @redis.zadd("sauce", 1, "veloute")
121
+ @redis.zadd("sauce", 2, "espagnole")
122
+ @redis.zadd("sauce", 3, "hollandaise")
123
+ @redis.zadd("sauce", 4, "classic tomate")
124
+
125
+ Oboe::API.start_trace('redis_test', '', {}) do
126
+ @redis.zrange("sauce", 1, 3)
127
+ end
128
+
129
+ traces = get_all_traces
130
+ traces.count.must_equal 4
131
+ traces[2]['KVOp'].must_equal "zrange"
132
+ traces[2]['KVKey'].must_equal "sauce"
133
+ end
134
+
135
+ it "should trace zrangebyscore" do
136
+ min_server_version(1.0)
137
+
138
+ @redis.zadd("sauce", 0, "bechamel")
139
+ @redis.zadd("sauce", 1, "veloute")
140
+ @redis.zadd("sauce", 2, "espagnole")
141
+ @redis.zadd("sauce", 3, "hollandaise")
142
+ @redis.zadd("sauce", 4, "classic tomate")
143
+
144
+ Oboe::API.start_trace('redis_test', '', {}) do
145
+ @redis.zrangebyscore("sauce", "5", "(100")
146
+ end
147
+
148
+ traces = get_all_traces
149
+ traces.count.must_equal 4
150
+ traces[2]['KVOp'].must_equal "zrangebyscore"
151
+ traces[2]['KVKey'].must_equal "sauce"
152
+ end
153
+
154
+ it "should trace zrank" do
155
+ min_server_version(2.0)
156
+
157
+ @redis.zadd("sauce", 0, "bechamel")
158
+ @redis.zadd("sauce", 1, "veloute")
159
+ @redis.zadd("sauce", 2, "espagnole")
160
+ @redis.zadd("sauce", 3, "hollandaise")
161
+ @redis.zadd("sauce", 4, "classic tomate")
162
+
163
+ Oboe::API.start_trace('redis_test', '', {}) do
164
+ @redis.zrank("sauce", "veloute")
165
+ end
166
+
167
+ traces = get_all_traces
168
+ traces.count.must_equal 4
169
+ traces[2]['KVOp'].must_equal "zrank"
170
+ traces[2]['KVKey'].must_equal "sauce"
171
+ end
172
+
173
+ it "should trace zrem" do
174
+ min_server_version(1.2)
175
+
176
+ @redis.zadd("sauce", 0, "bechamel")
177
+ @redis.zadd("sauce", 1, "veloute")
178
+ @redis.zadd("sauce", 2, "espagnole")
179
+ @redis.zadd("sauce", 3, "hollandaise")
180
+ @redis.zadd("sauce", 4, "classic tomate")
181
+
182
+ Oboe::API.start_trace('redis_test', '', {}) do
183
+ @redis.zrem("sauce", "veloute")
184
+ end
185
+
186
+ traces = get_all_traces
187
+ traces.count.must_equal 4
188
+ traces[2]['KVOp'].must_equal "zrem"
189
+ traces[2]['KVKey'].must_equal "sauce"
190
+ end
191
+
192
+ it "should trace zremrangebyrank" do
193
+ min_server_version(2.0)
194
+
195
+ @redis.zadd("sauce", 0, "bechamel")
196
+ @redis.zadd("sauce", 1, "veloute")
197
+ @redis.zadd("sauce", 2, "espagnole")
198
+ @redis.zadd("sauce", 3, "hollandaise")
199
+ @redis.zadd("sauce", 4, "classic tomate")
200
+
201
+ Oboe::API.start_trace('redis_test', '', {}) do
202
+ @redis.zremrangebyrank("sauce", -5, -1)
203
+ end
204
+
205
+ traces = get_all_traces
206
+ traces.count.must_equal 4
207
+ traces[2]['KVOp'].must_equal "zremrangebyrank"
208
+ traces[2]['KVKey'].must_equal "sauce"
209
+ traces[2]['start'].must_equal "-5"
210
+ traces[2]['stop'].must_equal "-1"
211
+ end
212
+
213
+ it "should trace zremrangebyscore" do
214
+ min_server_version(1.2)
215
+
216
+ @redis.zadd("sauce", 0, "bechamel")
217
+ @redis.zadd("sauce", 1, "veloute")
218
+ @redis.zadd("sauce", 2, "espagnole")
219
+ @redis.zadd("sauce", 3, "hollandaise")
220
+ @redis.zadd("sauce", 4, "classic tomate")
221
+
222
+ Oboe::API.start_trace('redis_test', '', {}) do
223
+ @redis.zremrangebyscore("sauce", -5, -1)
224
+ end
225
+
226
+ traces = get_all_traces
227
+ traces.count.must_equal 4
228
+ traces[2]['KVOp'].must_equal "zremrangebyscore"
229
+ traces[2]['KVKey'].must_equal "sauce"
230
+ end
231
+
232
+ it "should trace zrevrange" do
233
+ min_server_version(1.2)
234
+
235
+ @redis.zadd("sauce", 0, "bechamel")
236
+ @redis.zadd("sauce", 1, "veloute")
237
+ @redis.zadd("sauce", 2, "espagnole")
238
+ @redis.zadd("sauce", 3, "hollandaise")
239
+ @redis.zadd("sauce", 4, "classic tomate")
240
+
241
+ Oboe::API.start_trace('redis_test', '', {}) do
242
+ @redis.zrevrange("sauce", 0, -1)
243
+ end
244
+
245
+ traces = get_all_traces
246
+ traces.count.must_equal 4
247
+ traces[2]['KVOp'].must_equal "zrevrange"
248
+ traces[2]['KVKey'].must_equal "sauce"
249
+ traces[2]['start'].must_equal "0"
250
+ traces[2]['stop'].must_equal "-1"
251
+ end
252
+
253
+ it "should trace zrevrangebyscore" do
254
+ min_server_version(1.2)
255
+
256
+ @redis.zadd("sauce", 0, "bechamel")
257
+ @redis.zadd("sauce", 1, "veloute")
258
+ @redis.zadd("sauce", 2, "espagnole")
259
+ @redis.zadd("sauce", 3, "hollandaise")
260
+ @redis.zadd("sauce", 4, "classic tomate")
261
+
262
+ Oboe::API.start_trace('redis_test', '', {}) do
263
+ @redis.zrevrangebyscore("sauce", "(100", "5")
264
+ end
265
+
266
+ traces = get_all_traces
267
+ traces.count.must_equal 4
268
+ traces[2]['KVOp'].must_equal "zrevrangebyscore"
269
+ traces[2]['KVKey'].must_equal "sauce"
270
+ end
271
+
272
+ it "should trace zrevrank" do
273
+ min_server_version(2.0)
274
+
275
+ @redis.zadd("letters", 0, "a")
276
+ @redis.zadd("letters", 1, "b")
277
+ @redis.zadd("letters", 1, "c")
278
+
279
+ Oboe::API.start_trace('redis_test', '', {}) do
280
+ @redis.zrevrank("letters", "c")
281
+ end
282
+
283
+ traces = get_all_traces
284
+ traces.count.must_equal 4
285
+ traces[2]['KVOp'].must_equal "zrevrank"
286
+ traces[2]['KVKey'].must_equal "letters"
287
+ end
288
+
289
+ it "should trace zscore" do
290
+ min_server_version(1.2)
291
+
292
+ @redis.zadd("elements", 0, "fire")
293
+ @redis.zadd("elements", 1, "water")
294
+ @redis.zadd("elements", 1, "earth")
295
+ @redis.zadd("elements", 1, "air")
296
+
297
+ Oboe::API.start_trace('redis_test', '', {}) do
298
+ @redis.zscore("elements", "earth")
299
+ end
300
+
301
+ traces = get_all_traces
302
+ traces.count.must_equal 4
303
+ traces[2]['KVOp'].must_equal "zscore"
304
+ traces[2]['KVKey'].must_equal "elements"
305
+ end
306
+
307
+ it "should trace zunionstore" do
308
+ min_server_version(1.0)
309
+
310
+ @redis.zadd("colors", 0, "blueish")
311
+ @redis.zadd("colors", 1, "yellowish")
312
+ @redis.zadd("codes", 0, "0xff")
313
+
314
+ Oboe::API.start_trace('redis_test', '', {}) do
315
+ @redis.zunionstore("zdest", ["colors", "codes"])
316
+ end
317
+
318
+ traces = get_all_traces
319
+ traces.count.must_equal 4
320
+ traces[2]['KVOp'].must_equal "zunionstore"
321
+ traces[2]['destination'].must_equal "zdest"
322
+ traces[2].has_key?('KVKey').must_equal false
323
+ end
324
+ end
325
+