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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -0
  3. data/Appraisals +6 -16
  4. data/CHANGELOG.md +30 -14
  5. data/Gemfile +4 -3
  6. data/Gemfile.lock +20 -25
  7. data/Rakefile +5 -1
  8. data/ext/oboe_metal/extconf.rb +2 -2
  9. data/gemfiles/mongo.gemfile +33 -0
  10. data/gemfiles/moped.gemfile +33 -0
  11. data/lib/base.rb +28 -10
  12. data/lib/joboe_metal.rb +12 -34
  13. data/lib/method_profiling.rb +3 -3
  14. data/lib/oboe/api/layerinit.rb +14 -14
  15. data/lib/oboe/api/logging.rb +11 -11
  16. data/lib/oboe/api/profiling.rb +7 -6
  17. data/lib/oboe/api/tracing.rb +3 -3
  18. data/lib/oboe/api/util.rb +4 -4
  19. data/lib/oboe/config.rb +7 -7
  20. data/lib/oboe/frameworks/padrino.rb +2 -2
  21. data/lib/oboe/frameworks/rails.rb +11 -11
  22. data/lib/oboe/frameworks/rails/inst/action_controller.rb +4 -4
  23. data/lib/oboe/frameworks/rails/inst/action_view.rb +2 -2
  24. data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +1 -1
  25. data/lib/oboe/frameworks/rails/inst/action_view_30.rb +1 -1
  26. data/lib/oboe/frameworks/rails/inst/active_record.rb +1 -1
  27. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +3 -3
  28. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +2 -2
  29. data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +1 -1
  30. data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +8 -8
  31. data/lib/oboe/frameworks/sinatra.rb +33 -3
  32. data/lib/oboe/frameworks/sinatra/templates.rb +2 -2
  33. data/lib/oboe/inst/cassandra.rb +19 -19
  34. data/lib/oboe/inst/dalli.rb +7 -7
  35. data/lib/oboe/inst/http.rb +5 -5
  36. data/lib/oboe/inst/memcache.rb +14 -14
  37. data/lib/oboe/inst/memcached.rb +8 -8
  38. data/lib/oboe/inst/mongo.rb +2 -2
  39. data/lib/oboe/inst/moped.rb +29 -29
  40. data/lib/oboe/inst/rack.rb +3 -3
  41. data/lib/oboe/inst/redis.rb +24 -24
  42. data/lib/oboe/inst/resque.rb +4 -4
  43. data/lib/oboe/loading.rb +6 -6
  44. data/lib/oboe/logger.rb +4 -4
  45. data/lib/oboe/version.rb +1 -1
  46. data/lib/oboe_metal.rb +11 -39
  47. data/test/frameworks/apps/grape_simple.rb +1 -1
  48. data/test/frameworks/apps/sinatra_simple.rb +1 -1
  49. data/test/frameworks/padrino_test.rb +3 -3
  50. data/test/frameworks/sinatra_test.rb +3 -3
  51. data/test/instrumentation/cassandra_test.rb +45 -45
  52. data/test/instrumentation/http_test.rb +6 -6
  53. data/test/instrumentation/mongo_test.rb +347 -345
  54. data/test/instrumentation/moped_test.rb +40 -40
  55. data/test/instrumentation/redis_hashes_test.rb +20 -20
  56. data/test/instrumentation/redis_keys_test.rb +19 -19
  57. data/test/instrumentation/redis_lists_test.rb +22 -22
  58. data/test/instrumentation/redis_misc_test.rb +14 -14
  59. data/test/instrumentation/redis_sets_test.rb +20 -20
  60. data/test/instrumentation/redis_sortedsets_test.rb +25 -25
  61. data/test/instrumentation/redis_strings_test.rb +27 -27
  62. data/test/instrumentation/resque_test.rb +7 -7
  63. data/test/minitest_helper.rb +18 -6
  64. data/test/profiling/method_test.rb +24 -24
  65. data/test/support/liboboe_settings_test.rb +3 -3
  66. data/test/support/xtrace_test.rb +2 -2
  67. metadata +26 -32
  68. data/gemfiles/rails2.3.gemfile +0 -18
  69. data/gemfiles/rails2.3.gemfile.lock +0 -95
  70. data/gemfiles/rails3.0.gemfile +0 -18
  71. data/gemfiles/rails3.0.gemfile.lock +0 -142
  72. data/gemfiles/rails3.1.gemfile +0 -18
  73. data/gemfiles/rails3.1.gemfile.lock +0 -152
  74. data/gemfiles/rails3.2.gemfile +0 -18
  75. data/gemfiles/rails3.2.gemfile.lock +0 -150
@@ -7,8 +7,8 @@ if Oboe::Config[:nethttp][:enabled]
7
7
 
8
8
  Net::HTTP.class_eval do
9
9
  def request_with_oboe(*args, &block)
10
- unless started?
11
- return request_without_oboe(*args, &block)
10
+ unless started?
11
+ return request_without_oboe(*args, &block)
12
12
  end
13
13
 
14
14
  # Avoid cross host tracing for blacklisted domains
@@ -43,7 +43,7 @@ if Oboe::Config[:nethttp][:enabled]
43
43
  xtrace = resp.get_fields('X-Trace')
44
44
  xtrace = xtrace[0] if xtrace and xtrace.is_a?(Array)
45
45
 
46
- if Oboe::XTrace.valid?(xtrace) and Oboe.tracing?
46
+ if Oboe::XTrace.valid?(xtrace) and Oboe.tracing?
47
47
 
48
48
  # Assure that we received back a valid X-Trace with the same task_id
49
49
  if task_id == Oboe::XTrace.task_id(xtrace)
@@ -53,9 +53,9 @@ if Oboe::Config[:nethttp][:enabled]
53
53
  end
54
54
  end
55
55
  end
56
-
56
+
57
57
  opts['HTTPStatus'] = resp.code
58
-
58
+
59
59
  next resp
60
60
  ensure
61
61
  # Log the info event with the KVs in opts
@@ -5,7 +5,7 @@ module Oboe
5
5
  module Inst
6
6
  module MemCache
7
7
  include Oboe::API::Memcache
8
-
8
+
9
9
  def self.included(cls)
10
10
  Oboe.logger.info "[oboe/loading] Instrumenting memcache" if Oboe::Config[:verbose]
11
11
 
@@ -18,10 +18,10 @@ module Oboe
18
18
 
19
19
  if Oboe.tracing?
20
20
  Oboe::API.trace('memcache', report_kvs) do
21
- result = send("#{m}_without_oboe", *args)
21
+ result = send("#{m}_without_oboe", *args)
22
22
  end
23
23
  else
24
- result = send("#{m}_without_oboe", *args)
24
+ result = send("#{m}_without_oboe", *args)
25
25
  end
26
26
  result
27
27
  end
@@ -30,7 +30,7 @@ module Oboe
30
30
  class_eval "alias #{m} #{m}_with_oboe"
31
31
  end
32
32
  end
33
-
33
+
34
34
  [:request_setup, :cache_get, :get_multi].each do |m|
35
35
  if ::MemCache.method_defined? :request_setup
36
36
  cls.class_eval "alias #{m}_without_oboe #{m}"
@@ -43,16 +43,16 @@ module Oboe
43
43
 
44
44
  def get_multi_with_oboe(*args)
45
45
  return get_multi_without_oboe(args) unless Oboe.tracing?
46
-
46
+
47
47
  info_kvs = {}
48
-
48
+
49
49
  begin
50
50
  info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces]
51
-
51
+
52
52
  if args.last.is_a?(Hash) || args.last.nil?
53
53
  info_kvs[:KVKeyCount] = args.flatten.length - 1
54
54
  else
55
- info_kvs[:KVKeyCount] = args.flatten.length
55
+ info_kvs[:KVKeyCount] = args.flatten.length
56
56
  end
57
57
  rescue StandardError => e
58
58
  Oboe.logger.debug "[oboe/debug] Error collecting info keys: #{e.message}"
@@ -61,25 +61,25 @@ module Oboe
61
61
 
62
62
  Oboe::API.trace('memcache', {:KVOp => :get_multi}, :get_multi) do
63
63
  values = get_multi_without_oboe(args)
64
-
64
+
65
65
  info_kvs[:KVHitCount] = values.length
66
66
  Oboe::API.log('memcache', 'info', info_kvs)
67
-
68
- values
67
+
68
+ values
69
69
  end
70
70
  end
71
-
71
+
72
72
  def request_setup_with_oboe(*args)
73
73
  if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:get_multi)
74
74
  server, cache_key = request_setup_without_oboe(*args)
75
-
75
+
76
76
  info_kvs = { :KVKey => cache_key, :RemoteHost => server.host }
77
77
  info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces]
78
78
  Oboe::API.log('memcache', 'info', info_kvs)
79
79
 
80
80
  [server, cache_key]
81
81
  else
82
- request_setup_without_oboe(*args)
82
+ request_setup_without_oboe(*args)
83
83
  end
84
84
  end
85
85
 
@@ -5,7 +5,7 @@ module Oboe
5
5
  module Inst
6
6
  module Memcached
7
7
  include Oboe::API::Memcache
8
-
8
+
9
9
  def self.included(cls)
10
10
  Oboe.logger.info "[oboe/loading] Instrumenting memcached" if Oboe::Config[:verbose]
11
11
 
@@ -22,11 +22,11 @@ module Oboe
22
22
 
23
23
  Oboe::API.trace('memcache', opts) do
24
24
  result = send("#{m}_without_oboe", *args)
25
-
25
+
26
26
  info_kvs = {}
27
27
  info_kvs[:KVHit] = memcache_hit?(result) if m == :get and args.length and args[0].class == String
28
28
  info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcached][:collect_backtraces]
29
-
29
+
30
30
  Oboe::API.log('memcache', 'info', info_kvs) unless info_kvs.empty?
31
31
  result
32
32
  end
@@ -47,7 +47,7 @@ module Oboe
47
47
  alias get_multi_without_oboe get_multi
48
48
  alias get_multi get_multi_with_oboe
49
49
  elsif Oboe::Config[:verbose]
50
- Oboe.logger.warn "[oboe/loading] Couldn't properly instrument Memcached. Partial traces may occur."
50
+ Oboe.logger.warn "[oboe/loading] Couldn't properly instrument Memcached. Partial traces may occur."
51
51
  end
52
52
  end
53
53
  end
@@ -60,10 +60,10 @@ module Oboe
60
60
  Oboe::API.trace('memcache', layer_kvs || {}, :get_multi) do
61
61
  begin
62
62
  info_kvs = {}
63
- info_kvs[:KVKeyCount] = keys.flatten.length
63
+ info_kvs[:KVKeyCount] = keys.flatten.length
64
64
 
65
65
  values = get_multi_without_oboe(keys, raw)
66
-
66
+
67
67
  info_kvs[:KVHitCount] = values.length
68
68
  info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcached][:collect_backtraces]
69
69
 
@@ -71,7 +71,7 @@ module Oboe
71
71
  rescue
72
72
  values = get_multi_without_oboe(keys, raw)
73
73
  end
74
- values
74
+ values
75
75
  end
76
76
  else
77
77
  get_multi_without_oboe(keys, raw)
@@ -86,7 +86,7 @@ if defined?(::Memcached) and Oboe::Config[:memcached][:enabled]
86
86
  ::Memcached.class_eval do
87
87
  include Oboe::Inst::Memcached
88
88
  end
89
-
89
+
90
90
  if defined?(::Memcached::Rails)
91
91
  ::Memcached::Rails.class_eval do
92
92
  include Oboe::Inst::MemcachedRails
@@ -131,8 +131,8 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
131
131
 
132
132
  report_kvs[:QueryOp] = m
133
133
  report_kvs[:Query] = args[0].to_json if args and not args.empty? and args[0].class == Hash
134
- rescue
135
- Oboe.logger.debug "[oboe/debug] Exception in oboe_collect KV collection."
134
+ rescue StandardError => e
135
+ Oboe.logger.debug "[oboe/debug] Exception in oboe_collect KV collection: #{e.inspect}"
136
136
  end
137
137
  report_kvs
138
138
  end
@@ -15,7 +15,7 @@ module Oboe
15
15
  INDEX_OPS = [ :create, :drop ]
16
16
 
17
17
  # Moped::Query
18
- QUERY_OPS = [ :count, :sort, :limit, :distinct, :update, :update_all, :upsert,
18
+ QUERY_OPS = [ :count, :sort, :limit, :distinct, :update, :update_all, :upsert,
19
19
  :explain, :modify, :remove, :remove_all ]
20
20
 
21
21
  # Moped::Collection
@@ -31,7 +31,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
31
31
  module ::Moped
32
32
  class Database
33
33
  include Oboe::Inst::Moped
34
-
34
+
35
35
  def extract_trace_details(op)
36
36
  report_kvs = {}
37
37
  begin
@@ -46,7 +46,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
46
46
  end
47
47
  report_kvs
48
48
  end
49
-
49
+
50
50
  def command_with_oboe(command)
51
51
  if Oboe.tracing? and not Oboe::Context.layer_op and command.has_key?(:mapreduce)
52
52
  begin
@@ -74,7 +74,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
74
74
  drop_without_oboe
75
75
  end
76
76
  end
77
-
77
+
78
78
  Oboe::Inst::Moped::DB_OPS.each do |m|
79
79
  if method_defined?(m)
80
80
  class_eval "alias #{m}_without_oboe #{m}"
@@ -88,9 +88,9 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
88
88
 
89
89
  if defined?(::Moped::Indexes)
90
90
  module ::Moped
91
- class Indexes
91
+ class Indexes
92
92
  include Oboe::Inst::Moped
93
-
93
+
94
94
  def extract_trace_details(op)
95
95
  report_kvs = {}
96
96
  begin
@@ -105,7 +105,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
105
105
  end
106
106
  report_kvs
107
107
  end
108
-
108
+
109
109
  def create_with_oboe(key, options = {})
110
110
  return create_without_oboe(key, options = {}) unless Oboe.tracing?
111
111
 
@@ -123,10 +123,10 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
123
123
  create_without_oboe(key, options = {})
124
124
  end
125
125
  end
126
-
126
+
127
127
  def drop_with_oboe(key = nil)
128
128
  return drop_without_oboe(key = nil) unless Oboe.tracing?
129
-
129
+
130
130
  begin
131
131
  # We report :drop_indexes here to be consistent
132
132
  # with other mongo implementations
@@ -172,10 +172,10 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
172
172
  end
173
173
  report_kvs
174
174
  end
175
-
175
+
176
176
  def count_with_oboe
177
177
  return count_without_oboe unless Oboe.tracing?
178
-
178
+
179
179
  begin
180
180
  report_kvs = extract_trace_details(:count)
181
181
  report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
@@ -190,7 +190,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
190
190
 
191
191
  def sort_with_oboe(sort)
192
192
  return sort_without_oboe(sort) unless Oboe.tracing?
193
-
193
+
194
194
  begin
195
195
  report_kvs = extract_trace_details(:sort)
196
196
  report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
@@ -203,7 +203,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
203
203
  sort_without_oboe(sort)
204
204
  end
205
205
  end
206
-
206
+
207
207
  def limit_with_oboe(limit)
208
208
  if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:explain)
209
209
  begin
@@ -217,8 +217,8 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
217
217
  Oboe::API.trace('mongo', report_kvs) do
218
218
  limit_without_oboe(limit)
219
219
  end
220
- else
221
- limit_without_oboe(limit)
220
+ else
221
+ limit_without_oboe(limit)
222
222
  end
223
223
  end
224
224
 
@@ -237,7 +237,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
237
237
  distinct_without_oboe(key)
238
238
  end
239
239
  end
240
-
240
+
241
241
  def update_with_oboe(change, flags = nil)
242
242
  if Oboe.tracing? and not Oboe::Context.tracing_layer_op?([:update_all, :upsert])
243
243
  begin
@@ -255,10 +255,10 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
255
255
  update_without_oboe(change, flags = nil)
256
256
  end
257
257
  end
258
-
258
+
259
259
  def update_all_with_oboe(change)
260
260
  return update_all_without_oboe(change) unless Oboe.tracing?
261
-
261
+
262
262
  begin
263
263
  report_kvs = extract_trace_details(:update_all)
264
264
  report_kvs[:Update_Document] = change.to_json
@@ -273,7 +273,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
273
273
 
274
274
  def upsert_with_oboe(change)
275
275
  return upsert_without_oboe(change) unless Oboe.tracing?
276
-
276
+
277
277
  begin
278
278
  report_kvs = extract_trace_details(:upsert)
279
279
  report_kvs[:Query] = selector.to_json
@@ -289,7 +289,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
289
289
 
290
290
  def explain_with_oboe
291
291
  return explain_without_oboe unless Oboe.tracing?
292
-
292
+
293
293
  begin
294
294
  report_kvs = extract_trace_details(:explain)
295
295
  report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
@@ -318,7 +318,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
318
318
  modify_without_oboe(change, options)
319
319
  end
320
320
  end
321
-
321
+
322
322
  def remove_with_oboe
323
323
  return remove_without_oboe unless Oboe.tracing?
324
324
 
@@ -384,7 +384,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
384
384
 
385
385
  def drop_with_oboe
386
386
  return drop_without_oboe unless Oboe.tracing?
387
-
387
+
388
388
  # We report :drop_collection here to be consistent
389
389
  # with other mongo implementations
390
390
  report_kvs = extract_trace_details(:drop_collection)
@@ -396,7 +396,7 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
396
396
 
397
397
  def find_with_oboe(selector = {})
398
398
  return find_without_oboe(selector) unless Oboe.tracing?
399
-
399
+
400
400
  begin
401
401
  report_kvs = extract_trace_details(:find)
402
402
  report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
@@ -408,17 +408,17 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
408
408
  find_without_oboe(selector)
409
409
  end
410
410
  end
411
-
411
+
412
412
  def indexes_with_oboe
413
413
  return indexes_without_oboe unless Oboe.tracing?
414
-
414
+
415
415
  report_kvs = extract_trace_details(:indexes)
416
416
 
417
417
  Oboe::API.trace('mongo', report_kvs) do
418
418
  indexes_without_oboe
419
419
  end
420
420
  end
421
-
421
+
422
422
  def insert_with_oboe(documents, flags = nil)
423
423
  if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:create_index)
424
424
  report_kvs = extract_trace_details(:insert)
@@ -430,17 +430,17 @@ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
430
430
  insert_without_oboe(documents, flags)
431
431
  end
432
432
  end
433
-
433
+
434
434
  def aggregate_with_oboe(pipeline)
435
435
  return aggregate_without_oboe(pipeline) unless Oboe.tracing?
436
-
436
+
437
437
  report_kvs = extract_trace_details(:aggregate)
438
438
 
439
439
  Oboe::API.trace('mongo', report_kvs) do
440
440
  aggregate_without_oboe(pipeline)
441
441
  end
442
442
  end
443
-
443
+
444
444
  Oboe::Inst::Moped::COLLECTION_OPS.each do |m|
445
445
  if method_defined?(m)
446
446
  class_eval "alias #{m}_without_oboe #{m}"
@@ -37,7 +37,7 @@ module Oboe
37
37
  report_kvs['Forwarded-Port'] = env['HTTP_X_FORWARDED_PORT'] if env.has_key?('HTTP_X_FORWARDED_PORT')
38
38
 
39
39
  report_kvs['Ruby.Oboe.Version'] = ::Oboe::Version::STRING
40
- rescue Exception => e
40
+ rescue StandardError => e
41
41
  # Discard any potential exceptions. Debug log and report whatever we can.
42
42
  Oboe.logger.debug "[oboe/debug] Rack KV collection error: #{e.inspect}"
43
43
  end
@@ -49,7 +49,7 @@ module Oboe
49
49
 
50
50
  report_kvs = {}
51
51
  report_kvs[:URL] = URI.unescape(req.path)
52
-
52
+
53
53
  if Oboe.always?
54
54
  # Only report these KVs under tracing_mode 'always' (never for 'through')
55
55
  report_kvs[:SampleRate] = Oboe.sample_rate
@@ -63,7 +63,7 @@ module Oboe
63
63
  status, headers, response = @app.call(env)
64
64
 
65
65
  if Oboe.tracing?
66
- report_kvs = collect(req, env)
66
+ report_kvs = collect(req, env)
67
67
  Oboe::API.log(nil, 'info', report_kvs.merge!({ :Status => status }))
68
68
  end
69
69
 
@@ -6,7 +6,7 @@ module Oboe
6
6
  module Redis
7
7
  module Client
8
8
  # The operations listed in this constant skip collecting KVKey
9
- NO_KEY_OPS = [ :keys, :randomkey, :scan, :sdiff, :sdiffstore, :sinter,
9
+ NO_KEY_OPS = [ :keys, :randomkey, :scan, :sdiff, :sdiffstore, :sinter,
10
10
  :sinterstore, :smove, :sunion, :sunionstore, :zinterstore,
11
11
  :zunionstore, :publish, :select, :eval, :evalsha, :script ]
12
12
 
@@ -17,7 +17,7 @@ module Oboe
17
17
  :brpoplpush => { :destination => 2 }, :rpoplpush => { :destination => 2 },
18
18
  :sdiffstore => { :destination => 1 }, :sinterstore => { :destination => 1 },
19
19
  :sunionstore => { :destination => 1 }, :zinterstore => { :destination => 1 },
20
- :zunionstore => { :destination => 1 }, :publish => { :channel => 1 },
20
+ :zunionstore => { :destination => 1 }, :publish => { :channel => 1 },
21
21
  :incrby => { :increment => 2 }, :incrbyfloat => { :increment => 2 },
22
22
  :pexpire => { :milliseconds => 2 }, :pexpireat => { :milliseconds => 2 },
23
23
  :expireat => { :timestamp => 2 }, :decrby => { :decrement => 2 },
@@ -28,7 +28,7 @@ module Oboe
28
28
  :keys => { :pattern => 1 }, :expire => { :seconds => 2 },
29
29
  :rename => { :newkey => 2 }, :renamenx => { :newkey => 2 },
30
30
  :getbit => { :offset => 2 }, :setbit => { :offset => 2 },
31
- :setrange => { :offset => 2 }, :evalsha => { :sha => 1 },
31
+ :setrange => { :offset => 2 }, :evalsha => { :sha => 1 },
32
32
  :getrange => { :start => 2, :end => 3 },
33
33
  :zrange => { :start => 2, :end => 3 },
34
34
  :bitcount => { :start => 2, :stop => 3 },
@@ -40,17 +40,17 @@ module Oboe
40
40
  :hincrbyfloat => { :field => 2, :increment => 3 },
41
41
  :zremrangebyrank => { :start => 2, :stop => 3 },
42
42
  }
43
-
43
+
44
44
  # The following operations don't require any special handling. For these,
45
45
  # we only collect KVKey and KVOp
46
46
  #
47
- # :append, :blpop, :brpop, :decr, :del, :dump, :exists,
48
- # :hgetall, :hkeys, :hlen, :hvals, :hmset, :incr, :linsert,
49
- # :llen, :lpop, :lpush, :lpushx, :lrem, :lset, :ltrim,
50
- # :persist, :pttl, :hscan, :rpop, :rpush, :rpushx, :sadd,
51
- # :scard, :sismember, :smembers, :strlen, :sort, :spop,
52
- # :srandmember, :srem, :sscan, :ttl, :type, :zadd, :zcard,
53
- # :zcount, :zincrby, :zrangebyscore, :zrank, :zrem,
47
+ # :append, :blpop, :brpop, :decr, :del, :dump, :exists,
48
+ # :hgetall, :hkeys, :hlen, :hvals, :hmset, :incr, :linsert,
49
+ # :llen, :lpop, :lpush, :lpushx, :lrem, :lset, :ltrim,
50
+ # :persist, :pttl, :hscan, :rpop, :rpush, :rpushx, :sadd,
51
+ # :scard, :sismember, :smembers, :strlen, :sort, :spop,
52
+ # :srandmember, :srem, :sscan, :ttl, :type, :zadd, :zcard,
53
+ # :zcount, :zincrby, :zrangebyscore, :zrank, :zrem,
54
54
  # :zremrangebyscore, :zrevrank, :zrevrangebyscore, :zscore
55
55
  #
56
56
  # For the operations in NO_KEY_OPS (above) we only collect
@@ -103,10 +103,10 @@ module Oboe
103
103
  kvs[:nx] = options[:nx] if options.has_key?(:nx)
104
104
  kvs[:xx] = options[:xx] if options.has_key?(:xx)
105
105
  end
106
-
106
+
107
107
  when :get
108
108
  kvs[:KVHit] = r.nil? ? 0 : 1
109
-
109
+
110
110
  when :hdel, :hexists, :hget, :hset, :hsetnx
111
111
  kvs[:field] = command[2] unless command[2].is_a?(Array)
112
112
  if op == :hget
@@ -119,7 +119,7 @@ module Oboe
119
119
  else
120
120
  kvs[:Script] = command[1]
121
121
  end
122
-
122
+
123
123
  when :script
124
124
  kvs[:subcommand] = command[1]
125
125
  kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:redis][:collect_backtraces]
@@ -139,18 +139,18 @@ module Oboe
139
139
 
140
140
  when :mget
141
141
  if command[1].is_a?(Array)
142
- kvs[:KVKeyCount] = command[1].count
142
+ kvs[:KVKeyCount] = command[1].count
143
143
  else
144
144
  kvs[:KVKeyCount] = command.count - 1
145
- end
145
+ end
146
146
  values = r.select{ |i| i }
147
147
  kvs[:KVHitCount] = values.count
148
-
148
+
149
149
  when :hmget
150
150
  kvs[:KVKeyCount] = command.count - 2
151
151
  values = r.select{ |i| i }
152
152
  kvs[:KVHitCount] = values.count
153
-
153
+
154
154
  when :mset, :msetnx
155
155
  if command[1].is_a?(Array)
156
156
  kvs[:KVKeyCount] = command[1].count / 2
@@ -159,7 +159,7 @@ module Oboe
159
159
  end
160
160
  end # case op
161
161
  end # if KV_COLLECT_MAP[op]
162
-
162
+
163
163
  rescue StandardError => e
164
164
  Oboe.logger.debug "Error collecting redis KVs: #{e.message}"
165
165
  Oboe.logger.debug e.backtrace.join("\n")
@@ -188,7 +188,7 @@ module Oboe
188
188
  else
189
189
  kvs[:KVOp] = :pipeline
190
190
  end
191
-
191
+
192
192
  # Report pipelined operations if the number
193
193
  # of ops is reasonable
194
194
  if command_count < 12
@@ -207,7 +207,7 @@ module Oboe
207
207
 
208
208
  #
209
209
  # The wrapper method for Redis::Client.call. Here
210
- # (when tracing) we capture KVs to report and pass
210
+ # (when tracing) we capture KVs to report and pass
211
211
  # the call along
212
212
  #
213
213
  def call_with_oboe(command, &block)
@@ -229,7 +229,7 @@ module Oboe
229
229
  call_without_oboe(command, &block)
230
230
  end
231
231
  end
232
-
232
+
233
233
  #
234
234
  # The wrapper method for Redis::Client.call_pipeline. Here
235
235
  # (when tracing) we capture KVs to report and pass the call along
@@ -239,7 +239,7 @@ module Oboe
239
239
  report_kvs = {}
240
240
 
241
241
  # Fall back to the raw tracing API so we can pass KVs
242
- # back on exit (a limitation of the Oboe::API.trace
242
+ # back on exit (a limitation of the Oboe::API.trace
243
243
  # block method) This removes the need for an info
244
244
  # event to send additonal KVs
245
245
  ::Oboe::API.log_entry('redis', {})
@@ -264,7 +264,7 @@ module Oboe
264
264
  end
265
265
  end
266
266
 
267
- if Oboe::Config[:redis][:enabled]
267
+ if Oboe::Config[:redis][:enabled]
268
268
  if defined?(::Redis) and Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0')
269
269
  Oboe.logger.info "[oboe/loading] Instrumenting redis" if Oboe::Config[:verbose]
270
270
  ::Oboe::Util.send_include(::Redis::Client, ::Oboe::Inst::Redis::Client)