traceview 3.0.2-java → 3.0.3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +39 -14
  3. data/Gemfile +4 -62
  4. data/Rakefile +23 -8
  5. data/gemfiles/frameworks.gemfile +40 -0
  6. data/gemfiles/libraries.gemfile +78 -0
  7. data/gemfiles/rails23.gemfile +47 -0
  8. data/gemfiles/rails30.gemfile +47 -0
  9. data/gemfiles/rails31.gemfile +47 -0
  10. data/gemfiles/rails32.gemfile +47 -0
  11. data/gemfiles/rails40.gemfile +35 -0
  12. data/gemfiles/rails41.gemfile +35 -0
  13. data/gemfiles/rails42.gemfile +35 -0
  14. data/lib/traceview/api/logging.rb +84 -38
  15. data/lib/traceview/frameworks/rails/inst/action_controller.rb +1 -1
  16. data/lib/traceview/inst/moped.rb +2 -2
  17. data/lib/traceview/util.rb +30 -34
  18. data/lib/traceview/version.rb +1 -1
  19. data/test/frameworks/apps/grape_nested.rb +3 -0
  20. data/test/frameworks/apps/grape_simple.rb +3 -0
  21. data/test/frameworks/apps/sinatra_simple.rb +3 -0
  22. data/test/frameworks/grape_test.rb +8 -4
  23. data/test/frameworks/padrino_test.rb +6 -2
  24. data/test/frameworks/rails2x_test.rb +3 -0
  25. data/test/frameworks/rails3x_test.rb +91 -0
  26. data/test/frameworks/rails4x_test.rb +89 -0
  27. data/test/frameworks/sinatra_test.rb +3 -0
  28. data/test/instrumentation/cassandra_test.rb +11 -4
  29. data/test/instrumentation/dalli_test.rb +3 -0
  30. data/test/instrumentation/em_http_request_test.rb +3 -0
  31. data/test/instrumentation/excon_test.rb +3 -0
  32. data/test/instrumentation/faraday_test.rb +3 -0
  33. data/test/instrumentation/http_test.rb +3 -0
  34. data/test/instrumentation/httpclient_test.rb +3 -0
  35. data/test/instrumentation/memcache_test.rb +9 -0
  36. data/test/instrumentation/memcached_test.rb +3 -0
  37. data/test/instrumentation/mongo_test.rb +14 -3
  38. data/test/instrumentation/moped_test.rb +29 -6
  39. data/test/instrumentation/rack_test.rb +3 -0
  40. data/test/instrumentation/redis_hashes_test.rb +187 -184
  41. data/test/instrumentation/redis_keys_test.rb +223 -220
  42. data/test/instrumentation/redis_lists_test.rb +225 -225
  43. data/test/instrumentation/redis_misc_test.rb +123 -120
  44. data/test/instrumentation/redis_sets_test.rb +216 -213
  45. data/test/instrumentation/redis_sortedsets_test.rb +245 -242
  46. data/test/instrumentation/redis_strings_test.rb +242 -238
  47. data/test/instrumentation/resque_test.rb +3 -0
  48. data/test/instrumentation/rest-client_test.rb +3 -0
  49. data/test/instrumentation/sequel_mysql2_test.rb +4 -1
  50. data/test/instrumentation/sequel_mysql_test.rb +4 -1
  51. data/test/instrumentation/sequel_pg_test.rb +4 -1
  52. data/test/minitest_helper.rb +25 -8
  53. data/test/profiling/method_test.rb +3 -0
  54. data/test/servers/rackapp_8101.rb +1 -1
  55. data/test/servers/rails2x_8140.rb +2 -2
  56. data/test/servers/rails3x_8140.rb +78 -0
  57. data/test/servers/rails4x_8140.rb +78 -0
  58. data/test/support/backcompat_test.rb +3 -0
  59. data/test/support/config_test.rb +3 -0
  60. data/test/support/dnt_test.rb +3 -0
  61. data/test/support/liboboe_settings_test.rb +3 -0
  62. data/test/support/tvalias_test.rb +3 -0
  63. data/test/support/xtrace_test.rb +3 -0
  64. metadata +19 -5
  65. data/Appraisals +0 -10
  66. data/gemfiles/mongo.gemfile +0 -33
  67. data/gemfiles/moped.gemfile +0 -33
@@ -1,333 +1,337 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  require 'minitest_helper'
2
- require "redis"
3
5
 
4
- describe "Redis Strings" do
5
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
+ if defined?(::Redis)
7
+ describe "Redis Strings" do
8
+ attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
9
 
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
+ 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
- before do
14
- clear_all_traces
16
+ before do
17
+ clear_all_traces
15
18
 
16
- @redis ||= Redis.new
19
+ @redis ||= Redis.new
17
20
 
18
- @redis_version ||= @redis.info["redis_version"]
21
+ @redis_version ||= @redis.info["redis_version"]
19
22
 
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
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
24
27
 
25
- it "should trace append" do
26
- @redis.set("yourkey", "test")
28
+ it "should trace append" do
29
+ @redis.set("yourkey", "test")
27
30
 
28
- TraceView::API.start_trace('redis_test', '', {}) do
29
- @redis.append("yourkey", "blah")
31
+ TraceView::API.start_trace('redis_test', '', {}) do
32
+ @redis.append("yourkey", "blah")
33
+ end
34
+
35
+ traces = get_all_traces
36
+ traces.count.must_equal 4
37
+ traces[2]['KVOp'].must_equal "append"
38
+ traces[2]['KVKey'].must_equal "yourkey"
30
39
  end
31
40
 
32
- traces = get_all_traces
33
- traces.count.must_equal 4
34
- traces[2]['KVOp'].must_equal "append"
35
- traces[2]['KVKey'].must_equal "yourkey"
36
- end
41
+ it "should trace bitcount (>=2.6)" do
37
42
 
38
- it "should trace bitcount (>=2.6)" do
43
+ min_server_version("2.6")
39
44
 
40
- min_server_version("2.6")
45
+ TraceView::API.start_trace('redis_test', '', {}) do
46
+ @redis.bitcount("yourkey")
47
+ end
41
48
 
42
- TraceView::API.start_trace('redis_test', '', {}) do
43
- @redis.bitcount("yourkey")
49
+ traces = get_all_traces
50
+ traces.count.must_equal 4
51
+ traces[2]['KVOp'].must_equal "bitcount"
52
+ traces[2]['start'].must_equal 0
53
+ traces[2]['stop'].must_equal (-1)
44
54
  end
45
55
 
46
- traces = get_all_traces
47
- traces.count.must_equal 4
48
- traces[2]['KVOp'].must_equal "bitcount"
49
- traces[2]['start'].must_equal 0
50
- traces[2]['stop'].must_equal -1
51
- end
56
+ it "should trace bitop (>=2.6)" do
52
57
 
53
- it "should trace bitop (>=2.6)" do
58
+ min_server_version("2.6")
54
59
 
55
- min_server_version("2.6")
60
+ TraceView::API.start_trace('redis_test', '', {}) do
61
+ @redis.bitop("not", "bitopkey", "yourkey")
62
+ end
56
63
 
57
- TraceView::API.start_trace('redis_test', '', {}) do
58
- @redis.bitop("not", "bitopkey", "yourkey")
64
+ traces = get_all_traces
65
+ traces.count.must_equal 4
66
+ traces[2]['KVOp'].must_equal "bitop"
67
+ traces[2]['operation'].must_equal "not"
68
+ traces[2]['destkey'].must_equal "bitopkey"
59
69
  end
60
70
 
61
- traces = get_all_traces
62
- traces.count.must_equal 4
63
- traces[2]['KVOp'].must_equal "bitop"
64
- traces[2]['operation'].must_equal "not"
65
- traces[2]['destkey'].must_equal "bitopkey"
66
- end
71
+ it "should trace decr" do
72
+ @redis.setex("decr", 60, 0)
67
73
 
68
- it "should trace decr" do
69
- @redis.setex("decr", 60, 0)
74
+ TraceView::API.start_trace('redis_test', '', {}) do
75
+ @redis.decr("decr")
76
+ end
70
77
 
71
- TraceView::API.start_trace('redis_test', '', {}) do
72
- @redis.decr("decr")
78
+ traces = get_all_traces
79
+ traces.count.must_equal 4
80
+ traces[2]['KVOp'].must_equal "decr"
81
+ traces[2]['KVKey'].must_equal "decr"
73
82
  end
74
83
 
75
- traces = get_all_traces
76
- traces.count.must_equal 4
77
- traces[2]['KVOp'].must_equal "decr"
78
- traces[2]['KVKey'].must_equal "decr"
79
- end
84
+ it "should trace decrby" do
85
+ @redis.setex("decr", 60, 0)
80
86
 
81
- it "should trace decrby" do
82
- @redis.setex("decr", 60, 0)
87
+ TraceView::API.start_trace('redis_test', '', {}) do
88
+ @redis.decrby("decr", 1)
89
+ end
83
90
 
84
- TraceView::API.start_trace('redis_test', '', {}) do
85
- @redis.decrby("decr", 1)
91
+ traces = get_all_traces
92
+ traces.count.must_equal 4
93
+ traces[2]['KVOp'].must_equal "decrby"
94
+ traces[2]['KVKey'].must_equal "decr"
95
+ traces[2]['decrement'].must_equal 1
86
96
  end
87
97
 
88
- traces = get_all_traces
89
- traces.count.must_equal 4
90
- traces[2]['KVOp'].must_equal "decrby"
91
- traces[2]['KVKey'].must_equal "decr"
92
- traces[2]['decrement'].must_equal 1
93
- end
98
+ it "should trace get" do
99
+ @redis.setex("diwore", 60, "okokok")
94
100
 
95
- it "should trace get" do
96
- @redis.setex("diwore", 60, "okokok")
101
+ TraceView::API.start_trace('redis_test', '', {}) do
102
+ @rv = @redis.get("diwore")
103
+ end
97
104
 
98
- TraceView::API.start_trace('redis_test', '', {}) do
99
- @rv = @redis.get("diwore")
100
- end
105
+ @rv.must_equal "okokok"
101
106
 
102
- @rv.must_equal "okokok"
107
+ traces = get_all_traces
108
+ traces.count.must_equal 4
109
+ traces[2]['KVOp'].must_equal "get"
110
+ traces[2]['KVKey'].must_equal "diwore"
111
+ end
103
112
 
104
- traces = get_all_traces
105
- traces.count.must_equal 4
106
- traces[2]['KVOp'].must_equal "get"
107
- traces[2]['KVKey'].must_equal "diwore"
108
- end
113
+ it "should trace getbit" do
114
+ min_server_version(2.2)
109
115
 
110
- it "should trace getbit" do
111
- min_server_version(2.2)
116
+ @redis.setex("diwore", 60, "okokok")
112
117
 
113
- @redis.setex("diwore", 60, "okokok")
118
+ TraceView::API.start_trace('redis_test', '', {}) do
119
+ @redis.getbit("diwore", 3)
120
+ end
114
121
 
115
- TraceView::API.start_trace('redis_test', '', {}) do
116
- @redis.getbit("diwore", 3)
122
+ traces = get_all_traces
123
+ traces.count.must_equal 4
124
+ traces[2]['KVOp'].must_equal "getbit"
125
+ traces[2]['KVKey'].must_equal "diwore"
126
+ traces[2]['offset'].must_equal 3
117
127
  end
118
128
 
119
- traces = get_all_traces
120
- traces.count.must_equal 4
121
- traces[2]['KVOp'].must_equal "getbit"
122
- traces[2]['KVKey'].must_equal "diwore"
123
- traces[2]['offset'].must_equal 3
124
- end
129
+ it "should trace getrange" do
130
+ min_server_version(2.2)
125
131
 
126
- it "should trace getrange" do
127
- min_server_version(2.2)
132
+ TraceView::API.start_trace('redis_test', '', {}) do
133
+ @redis.getrange("yourkey", 0, 3)
134
+ end
128
135
 
129
- TraceView::API.start_trace('redis_test', '', {}) do
130
- @redis.getrange("yourkey", 0, 3)
136
+ traces = get_all_traces
137
+ traces.count.must_equal 4
138
+ traces[2]['KVOp'].must_equal "getrange"
139
+ traces[2]['KVKey'].must_equal "yourkey"
140
+ traces[2]['start'].must_equal 0
141
+ traces[2]['end'].must_equal 3
131
142
  end
132
143
 
133
- traces = get_all_traces
134
- traces.count.must_equal 4
135
- traces[2]['KVOp'].must_equal "getrange"
136
- traces[2]['KVKey'].must_equal "yourkey"
137
- traces[2]['start'].must_equal 0
138
- traces[2]['end'].must_equal 3
139
- end
144
+ it "should trace getset" do
145
+ min_server_version(2.2)
140
146
 
141
- it "should trace getset" do
142
- min_server_version(2.2)
147
+ TraceView::API.start_trace('redis_test', '', {}) do
148
+ @redis.getset("dollar", 0)
149
+ end
143
150
 
144
- TraceView::API.start_trace('redis_test', '', {}) do
145
- @redis.getset("dollar", 0)
151
+ traces = get_all_traces
152
+ traces.count.must_equal 4
153
+ traces[2]['KVOp'].must_equal "getset"
154
+ traces[2]['KVKey'].must_equal "dollar"
155
+ traces[2]['value'].must_equal "0"
146
156
  end
147
157
 
148
- traces = get_all_traces
149
- traces.count.must_equal 4
150
- traces[2]['KVOp'].must_equal "getset"
151
- traces[2]['KVKey'].must_equal "dollar"
152
- traces[2]['value'].must_equal "0"
153
- end
158
+ it "should trace incr" do
159
+ @redis.setex("dotcom", 60, 0)
154
160
 
155
- it "should trace incr" do
156
- @redis.setex("dotcom", 60, 0)
161
+ TraceView::API.start_trace('redis_test', '', {}) do
162
+ @redis.incr("dotcom")
163
+ end
157
164
 
158
- TraceView::API.start_trace('redis_test', '', {}) do
159
- @redis.incr("dotcom")
165
+ traces = get_all_traces
166
+ traces.count.must_equal 4
167
+ traces[2]['KVOp'].must_equal "incr"
168
+ traces[2]['KVKey'].must_equal "dotcom"
160
169
  end
161
170
 
162
- traces = get_all_traces
163
- traces.count.must_equal 4
164
- traces[2]['KVOp'].must_equal "incr"
165
- traces[2]['KVKey'].must_equal "dotcom"
166
- end
171
+ it "should trace incrby" do
172
+ @redis.setex("incr", 60, 0)
167
173
 
168
- it "should trace incrby" do
169
- @redis.setex("incr", 60, 0)
174
+ TraceView::API.start_trace('redis_test', '', {}) do
175
+ @redis.incrby("incr", 1)
176
+ end
170
177
 
171
- TraceView::API.start_trace('redis_test', '', {}) do
172
- @redis.incrby("incr", 1)
178
+ traces = get_all_traces
179
+ traces.count.must_equal 4
180
+ traces[2]['KVOp'].must_equal "incrby"
181
+ traces[2]['KVKey'].must_equal "incr"
182
+ traces[2]['increment'].must_equal 1
173
183
  end
174
184
 
175
- traces = get_all_traces
176
- traces.count.must_equal 4
177
- traces[2]['KVOp'].must_equal "incrby"
178
- traces[2]['KVKey'].must_equal "incr"
179
- traces[2]['increment'].must_equal 1
180
- end
185
+ it "should trace incrbyfloat" do
186
+ min_server_version(2.6)
181
187
 
182
- it "should trace incrbyfloat" do
183
- min_server_version(2.6)
188
+ @redis.setex("incrfloat", 60, 0.0)
184
189
 
185
- @redis.setex("incrfloat", 60, 0.0)
190
+ TraceView::API.start_trace('redis_test', '', {}) do
191
+ @redis.incrbyfloat("incrfloat", 1.01)
192
+ end
186
193
 
187
- TraceView::API.start_trace('redis_test', '', {}) do
188
- @redis.incrbyfloat("incrfloat", 1.01)
194
+ traces = get_all_traces
195
+ traces.count.must_equal 4
196
+ traces[2]['KVOp'].must_equal "incrbyfloat"
197
+ traces[2]['KVKey'].must_equal "incrfloat"
198
+ traces[2]['increment'].must_equal 1.01
189
199
  end
190
200
 
191
- traces = get_all_traces
192
- traces.count.must_equal 4
193
- traces[2]['KVOp'].must_equal "incrbyfloat"
194
- traces[2]['KVKey'].must_equal "incrfloat"
195
- traces[2]['increment'].must_equal 1.01
196
- end
197
-
198
- it "should trace mget" do
199
- @redis.setex("france", 60, "ok")
200
- @redis.setex("denmark", 60, "ok")
201
- @redis.setex("germany", 60, "ok")
202
-
203
- TraceView::API.start_trace('redis_test', '', {}) do
204
- @redis.mget(["france", "nothing", "denmark"])
205
- @redis.mget("germany")
201
+ it "should trace mget" do
202
+ @redis.setex("france", 60, "ok")
203
+ @redis.setex("denmark", 60, "ok")
204
+ @redis.setex("germany", 60, "ok")
205
+
206
+ TraceView::API.start_trace('redis_test', '', {}) do
207
+ @redis.mget(["france", "nothing", "denmark"])
208
+ @redis.mget("germany")
209
+ end
210
+
211
+ traces = get_all_traces
212
+ traces.count.must_equal 6
213
+ traces[2]['KVOp'].must_equal "mget"
214
+ traces[2]['KVKeyCount'].must_equal 3
215
+ traces[2]['KVHitCount'].must_equal 2
216
+ traces[4]['KVOp'].must_equal "mget"
217
+ traces[4]['KVKeyCount'].must_equal 1
218
+ traces[4]['KVHitCount'].must_equal 1
206
219
  end
207
220
 
208
- traces = get_all_traces
209
- traces.count.must_equal 6
210
- traces[2]['KVOp'].must_equal "mget"
211
- traces[2]['KVKeyCount'].must_equal 3
212
- traces[2]['KVHitCount'].must_equal 2
213
- traces[4]['KVOp'].must_equal "mget"
214
- traces[4]['KVKeyCount'].must_equal 1
215
- traces[4]['KVHitCount'].must_equal 1
216
- end
217
-
218
- it "should trace mset" do
219
- TraceView::API.start_trace('redis_test', '', {}) do
220
- @redis.mset(["one", 1, "two", 2, "three", 3])
221
- @redis.mset("one", 1)
221
+ it "should trace mset" do
222
+ TraceView::API.start_trace('redis_test', '', {}) do
223
+ @redis.mset(["one", 1, "two", 2, "three", 3])
224
+ @redis.mset("one", 1)
225
+ end
226
+
227
+ traces = get_all_traces
228
+ traces.count.must_equal 6
229
+ traces[2]['KVOp'].must_equal "mset"
230
+ traces[2]['KVKeyCount'].must_equal 3
231
+ traces[4]['KVOp'].must_equal "mset"
232
+ traces[4]['KVKeyCount'].must_equal 1
222
233
  end
223
234
 
224
- traces = get_all_traces
225
- traces.count.must_equal 6
226
- traces[2]['KVOp'].must_equal "mset"
227
- traces[2]['KVKeyCount'].must_equal 3
228
- traces[4]['KVOp'].must_equal "mset"
229
- traces[4]['KVKeyCount'].must_equal 1
230
- end
235
+ it "should trace msetnx" do
236
+ TraceView::API.start_trace('redis_test', '', {}) do
237
+ @redis.msetnx(["one", 1, "two", 2, "three", 3])
238
+ end
231
239
 
232
- it "should trace msetnx" do
233
- TraceView::API.start_trace('redis_test', '', {}) do
234
- @redis.msetnx(["one", 1, "two", 2, "three", 3])
240
+ traces = get_all_traces
241
+ traces.count.must_equal 4
242
+ traces[2]['KVOp'].must_equal "msetnx"
235
243
  end
236
244
 
237
- traces = get_all_traces
238
- traces.count.must_equal 4
239
- traces[2]['KVOp'].must_equal "msetnx"
240
- end
245
+ it "should trace psetex (>= v2.6)" do
241
246
 
242
- it "should trace psetex (>= v2.6)" do
247
+ TraceView::API.start_trace('redis_test', '', {}) do
248
+ @redis.psetex("one", 60, "hello")
249
+ end
243
250
 
244
- TraceView::API.start_trace('redis_test', '', {}) do
245
- @redis.psetex("one", 60, "hello")
251
+ traces = get_all_traces
252
+ traces.count.must_equal 4
253
+ traces[2]['KVOp'].must_equal "psetex"
254
+ traces[2]['KVKey'].must_equal "one"
255
+ traces[2]['ttl'].must_equal 60
246
256
  end
247
257
 
248
- traces = get_all_traces
249
- traces.count.must_equal 4
250
- traces[2]['KVOp'].must_equal "psetex"
251
- traces[2]['KVKey'].must_equal "one"
252
- traces[2]['ttl'].must_equal 60
253
- end
258
+ it "should trace basic set" do
259
+ TraceView::API.start_trace('redis_test', '', {}) do
260
+ @redis.set("one", "hello")
261
+ end
254
262
 
255
- it "should trace basic set" do
256
- TraceView::API.start_trace('redis_test', '', {}) do
257
- @redis.set("one", "hello")
263
+ traces = get_all_traces
264
+ traces.count.must_equal 4
265
+ traces[2]['KVOp'].must_equal "set"
266
+ traces[2]['KVKey'].must_equal "one"
258
267
  end
259
268
 
260
- traces = get_all_traces
261
- traces.count.must_equal 4
262
- traces[2]['KVOp'].must_equal "set"
263
- traces[2]['KVKey'].must_equal "one"
264
- end
269
+ it "should trace setbit" do
270
+ min_server_version(2.2)
265
271
 
266
- it "should trace setbit" do
267
- min_server_version(2.2)
272
+ TraceView::API.start_trace('redis_test', '', {}) do
273
+ @redis.setbit("yourkey", 3, 0)
274
+ end
268
275
 
269
- TraceView::API.start_trace('redis_test', '', {}) do
270
- @redis.setbit("yourkey", 3, 0)
276
+ traces = get_all_traces
277
+ traces.count.must_equal 4
278
+ traces[2]['KVOp'].must_equal "setbit"
279
+ traces[2]['KVKey'].must_equal "yourkey"
280
+ traces[2]['offset'].must_equal 3
271
281
  end
272
282
 
273
- traces = get_all_traces
274
- traces.count.must_equal 4
275
- traces[2]['KVOp'].must_equal "setbit"
276
- traces[2]['KVKey'].must_equal "yourkey"
277
- traces[2]['offset'].must_equal 3
278
- end
283
+ it "should trace setex" do
284
+ TraceView::API.start_trace('redis_test', '', {}) do
285
+ @redis.setex("one", 60, "hello")
286
+ end
279
287
 
280
- it "should trace setex" do
281
- TraceView::API.start_trace('redis_test', '', {}) do
282
- @redis.setex("one", 60, "hello")
288
+ traces = get_all_traces
289
+ traces.count.must_equal 4
290
+ traces[2]['KVOp'].must_equal "setex"
291
+ traces[2]['KVKey'].must_equal "one"
292
+ traces[2]['ttl'].must_equal 60
283
293
  end
284
294
 
285
- traces = get_all_traces
286
- traces.count.must_equal 4
287
- traces[2]['KVOp'].must_equal "setex"
288
- traces[2]['KVKey'].must_equal "one"
289
- traces[2]['ttl'].must_equal 60
290
- end
295
+ it "should trace setnx" do
296
+ TraceView::API.start_trace('redis_test', '', {}) do
297
+ @redis.setnx("one", "hello")
298
+ end
291
299
 
292
- it "should trace setnx" do
293
- TraceView::API.start_trace('redis_test', '', {}) do
294
- @redis.setnx("one", "hello")
300
+ traces = get_all_traces
301
+ traces.count.must_equal 4
302
+ traces[2]['KVOp'].must_equal "setnx"
303
+ traces[2]['KVKey'].must_equal "one"
295
304
  end
296
305
 
297
- traces = get_all_traces
298
- traces.count.must_equal 4
299
- traces[2]['KVOp'].must_equal "setnx"
300
- traces[2]['KVKey'].must_equal "one"
301
- end
306
+ it "should trace setrange" do
307
+ min_server_version(2.2)
302
308
 
303
- it "should trace setrange" do
304
- min_server_version(2.2)
309
+ @redis.setex("spandau_ballet", 60, "XXXXXXXXXXXXXXX")
305
310
 
306
- @redis.setex("spandau_ballet", 60, "XXXXXXXXXXXXXXX")
311
+ TraceView::API.start_trace('redis_test', '', {}) do
312
+ @redis.setrange("yourkey", 2, "ok")
313
+ end
307
314
 
308
- TraceView::API.start_trace('redis_test', '', {}) do
309
- @redis.setrange("yourkey", 2, "ok")
315
+ traces = get_all_traces
316
+ traces.count.must_equal 4
317
+ traces[2]['KVOp'].must_equal "setrange"
318
+ traces[2]['KVKey'].must_equal "yourkey"
319
+ traces[2]['offset'].must_equal 2
310
320
  end
311
321
 
312
- traces = get_all_traces
313
- traces.count.must_equal 4
314
- traces[2]['KVOp'].must_equal "setrange"
315
- traces[2]['KVKey'].must_equal "yourkey"
316
- traces[2]['offset'].must_equal 2
317
- end
322
+ it "should trace strlen" do
323
+ min_server_version(2.2)
318
324
 
319
- it "should trace strlen" do
320
- min_server_version(2.2)
325
+ @redis.setex("talking_heads", 60, "burning down the house")
321
326
 
322
- @redis.setex("talking_heads", 60, "burning down the house")
327
+ TraceView::API.start_trace('redis_test', '', {}) do
328
+ @redis.strlen("talking_heads")
329
+ end
323
330
 
324
- TraceView::API.start_trace('redis_test', '', {}) do
325
- @redis.strlen("talking_heads")
331
+ traces = get_all_traces
332
+ traces.count.must_equal 4
333
+ traces[2]['KVOp'].must_equal "strlen"
334
+ traces[2]['KVKey'].must_equal "talking_heads"
326
335
  end
327
-
328
- traces = get_all_traces
329
- traces.count.must_equal 4
330
- traces[2]['KVOp'].must_equal "strlen"
331
- traces[2]['KVKey'].must_equal "talking_heads"
332
336
  end
333
337
  end