oboe 2.4.0.1 → 2.5.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,333 @@
1
+ require 'minitest_helper'
2
+ require "redis"
3
+
4
+ describe Oboe::Inst::Redis, :strings 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 append" do
26
+ @redis.set("yourkey", "test")
27
+
28
+ Oboe::API.start_trace('redis_test', '', {}) do
29
+ @redis.append("yourkey", "blah")
30
+ end
31
+
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
37
+
38
+ it "should trace bitcount (>=2.6)" do
39
+
40
+ min_server_version("2.6")
41
+
42
+ Oboe::API.start_trace('redis_test', '', {}) do
43
+ @redis.bitcount("yourkey")
44
+ end
45
+
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
52
+
53
+ it "should trace bitop (>=2.6)" do
54
+
55
+ min_server_version("2.6")
56
+
57
+ Oboe::API.start_trace('redis_test', '', {}) do
58
+ @redis.bitop("not", "bitopkey", "yourkey")
59
+ end
60
+
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
67
+
68
+ it "should trace decr" do
69
+ @redis.setex("decr", 60, 0)
70
+
71
+ Oboe::API.start_trace('redis_test', '', {}) do
72
+ @redis.decr("decr")
73
+ end
74
+
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
80
+
81
+ it "should trace decrby" do
82
+ @redis.setex("decr", 60, 0)
83
+
84
+ Oboe::API.start_trace('redis_test', '', {}) do
85
+ @redis.decrby("decr", 1)
86
+ end
87
+
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
94
+
95
+ it "should trace get" do
96
+ @redis.setex("diwore", 60, "okokok")
97
+
98
+ Oboe::API.start_trace('redis_test', '', {}) do
99
+ @rv = @redis.get("diwore")
100
+ end
101
+
102
+ @rv.must_equal "okokok"
103
+
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
109
+
110
+ it "should trace getbit" do
111
+ min_server_version(2.2)
112
+
113
+ @redis.setex("diwore", 60, "okokok")
114
+
115
+ Oboe::API.start_trace('redis_test', '', {}) do
116
+ @redis.getbit("diwore", 3)
117
+ end
118
+
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
125
+
126
+ it "should trace getrange" do
127
+ min_server_version(2.2)
128
+
129
+ Oboe::API.start_trace('redis_test', '', {}) do
130
+ @redis.getrange("yourkey", 0, 3)
131
+ end
132
+
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
140
+
141
+ it "should trace getset" do
142
+ min_server_version(2.2)
143
+
144
+ Oboe::API.start_trace('redis_test', '', {}) do
145
+ @redis.getset("dollar", 0)
146
+ end
147
+
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
154
+
155
+ it "should trace incr" do
156
+ @redis.setex("dotcom", 60, 0)
157
+
158
+ Oboe::API.start_trace('redis_test', '', {}) do
159
+ @redis.incr("dotcom")
160
+ end
161
+
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
167
+
168
+ it "should trace incrby" do
169
+ @redis.setex("incr", 60, 0)
170
+
171
+ Oboe::API.start_trace('redis_test', '', {}) do
172
+ @redis.incrby("incr", 1)
173
+ end
174
+
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
181
+
182
+ it "should trace incrbyfloat" do
183
+ min_server_version(2.6)
184
+
185
+ @redis.setex("incrfloat", 60, 0.0)
186
+
187
+ Oboe::API.start_trace('redis_test', '', {}) do
188
+ @redis.incrbyfloat("incrfloat", 1.01)
189
+ end
190
+
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
+ Oboe::API.start_trace('redis_test', '', {}) do
204
+ @redis.mget(["france", "nothing", "denmark"])
205
+ @redis.mget("germany")
206
+ end
207
+
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
+ Oboe::API.start_trace('redis_test', '', {}) do
220
+ @redis.mset(["one", 1, "two", 2, "three", 3])
221
+ @redis.mset("one", 1)
222
+ end
223
+
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
231
+
232
+ it "should trace msetnx" do
233
+ Oboe::API.start_trace('redis_test', '', {}) do
234
+ @redis.msetnx(["one", 1, "two", 2, "three", 3])
235
+ end
236
+
237
+ traces = get_all_traces
238
+ traces.count.must_equal 4
239
+ traces[2]['KVOp'].must_equal "msetnx"
240
+ end
241
+
242
+ it "should trace psetex (>= v2.6)" do
243
+
244
+ Oboe::API.start_trace('redis_test', '', {}) do
245
+ @redis.psetex("one", 60, "hello")
246
+ end
247
+
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
254
+
255
+ it "should trace basic set" do
256
+ Oboe::API.start_trace('redis_test', '', {}) do
257
+ @redis.set("one", "hello")
258
+ end
259
+
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
265
+
266
+ it "should trace setbit" do
267
+ min_server_version(2.2)
268
+
269
+ Oboe::API.start_trace('redis_test', '', {}) do
270
+ @redis.setbit("yourkey", 3, 0)
271
+ end
272
+
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
279
+
280
+ it "should trace setex" do
281
+ Oboe::API.start_trace('redis_test', '', {}) do
282
+ @redis.setex("one", 60, "hello")
283
+ end
284
+
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
291
+
292
+ it "should trace setnx" do
293
+ Oboe::API.start_trace('redis_test', '', {}) do
294
+ @redis.setnx("one", "hello")
295
+ end
296
+
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
302
+
303
+ it "should trace setrange" do
304
+ min_server_version(2.2)
305
+
306
+ @redis.setex("spandau_ballet", 60, "XXXXXXXXXXXXXXX")
307
+
308
+ Oboe::API.start_trace('redis_test', '', {}) do
309
+ @redis.setrange("yourkey", 2, "ok")
310
+ end
311
+
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
318
+
319
+ it "should trace strlen" do
320
+ min_server_version(2.2)
321
+
322
+ @redis.setex("talking_heads", 60, "burning down the house")
323
+
324
+ Oboe::API.start_trace('redis_test', '', {}) do
325
+ @redis.strlen("talking_heads")
326
+ 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
+ end
333
+ end
@@ -19,13 +19,12 @@ require 'memcache'
19
19
  $trace_file = @trace_dir + "trace_output.bson"
20
20
 
21
21
  # Configure Oboe
22
+ Oboe::Config[:verbose] = true
22
23
  Oboe::Config[:tracing_mode] = "always"
23
24
  Oboe::Config[:sample_rate] = 1000000
24
25
  Oboe::Ruby.initialize
25
26
  Oboe.logger.level = Logger::DEBUG
26
27
 
27
- Oboe.logger.debug "[oboe/test] Debug log output test."
28
-
29
28
  ##
30
29
  # clear_all_traces
31
30
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0.1
4
+ version: 2.5.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-12 00:00:00.000000000 Z
12
+ date: 2014-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -50,7 +50,7 @@ files:
50
50
  - .gitignore
51
51
  - .travis.yml
52
52
  - Appraisals
53
- - CHANGELOG
53
+ - CHANGELOG.md
54
54
  - Gemfile
55
55
  - LICENSE
56
56
  - README.md
@@ -107,6 +107,7 @@ files:
107
107
  - lib/oboe/inst/mongo.rb
108
108
  - lib/oboe/inst/moped.rb
109
109
  - lib/oboe/inst/rack.rb
110
+ - lib/oboe/inst/redis.rb
110
111
  - lib/oboe/inst/resque.rb
111
112
  - lib/oboe/instrumentation.rb
112
113
  - lib/oboe/loading.rb
@@ -128,12 +129,21 @@ files:
128
129
  - test/instrumentation/mongo_test.rb
129
130
  - test/instrumentation/moped_test.rb
130
131
  - test/instrumentation/rack_test.rb
132
+ - test/instrumentation/redis_hashes_test.rb
133
+ - test/instrumentation/redis_keys_test.rb
134
+ - test/instrumentation/redis_lists_test.rb
135
+ - test/instrumentation/redis_misc_test.rb
136
+ - test/instrumentation/redis_sets_test.rb
137
+ - test/instrumentation/redis_sortedsets_test.rb
138
+ - test/instrumentation/redis_strings_test.rb
131
139
  - test/instrumentation/resque_test.rb
132
140
  - test/minitest_helper.rb
133
141
  - test/profiling/method_test.rb
134
142
  - test/support/config_test.rb
135
143
  - test/support/srv1_localset_test.rb
136
144
  - test/support/xtrace_test.rb
145
+ - test/frameworks/apps/padrino_simple.rb
146
+ - test/frameworks/test_padrino.rb
137
147
  homepage: http://www.appneta.com/products/traceview/
138
148
  licenses:
139
149
  - AppNeta Open License, Version 1.0
@@ -159,17 +169,27 @@ signing_key:
159
169
  specification_version: 4
160
170
  summary: AppNeta TraceView performance instrumentation gem for Ruby
161
171
  test_files:
172
+ - test/frameworks/apps/padrino_simple.rb
173
+ - test/frameworks/test_padrino.rb
162
174
  - test/minitest_helper.rb
163
175
  - test/instrumentation/mongo_test.rb
176
+ - test/instrumentation/redis_hashes_test.rb
177
+ - test/instrumentation/redis_misc_test.rb
164
178
  - test/instrumentation/dalli_test.rb
179
+ - test/instrumentation/redis_keys_test.rb
180
+ - test/instrumentation/redis_sortedsets_test.rb
181
+ - test/instrumentation/redis_strings_test.rb
182
+ - test/instrumentation/redis_sets_test.rb
165
183
  - test/instrumentation/http_test.rb
166
184
  - test/instrumentation/resque_test.rb
167
185
  - test/instrumentation/moped_test.rb
168
186
  - test/instrumentation/rack_test.rb
169
187
  - test/instrumentation/memcache_test.rb
188
+ - test/instrumentation/redis_lists_test.rb
170
189
  - test/instrumentation/cassandra_test.rb
171
190
  - test/instrumentation/memcached_test.rb
172
191
  - test/profiling/method_test.rb
173
192
  - test/support/srv1_localset_test.rb
174
193
  - test/support/config_test.rb
175
194
  - test/support/xtrace_test.rb
195
+ has_rdoc: