lib/oboe/inst/memcached.rb in oboe-2.6.6.1 vs lib/oboe/inst/memcached.rb in oboe-2.6.7.1

- old
+ new

@@ -3,11 +3,11 @@ module Oboe module Inst module Memcached include Oboe::API::Memcache - + def self.included(cls) Oboe.logger.info "[oboe/loading] Instrumenting memcached" if Oboe::Config[:verbose] cls.class_eval do MEMCACHE_OPS.reject { |m| not method_defined?(m) }.each do |m| @@ -20,15 +20,15 @@ opts[:RemoteHost] = rhost if rhost end Oboe::API.trace('memcache', opts) do result = send("#{m}_without_oboe", *args) - + info_kvs = {} info_kvs[:KVHit] = memcache_hit?(result) if m == :get and args.length and args[0].class == String info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcached][:collect_backtraces] - + Oboe::API.log('memcache', 'info', info_kvs) unless info_kvs.empty? result end end @@ -45,11 +45,11 @@ cls.class_eval do if ::Memcached::Rails.method_defined? :get_multi alias get_multi_without_oboe get_multi alias get_multi get_multi_with_oboe elsif Oboe::Config[:verbose] - Oboe.logger.warn "[oboe/loading] Couldn't properly instrument Memcached. Partial traces may occur." + Oboe.logger.warn "[oboe/loading] Couldn't properly instrument Memcached. Partial traces may occur." end end end def get_multi_with_oboe(keys, raw=false) @@ -58,22 +58,22 @@ layer_kvs[:KVOp] = :get_multi Oboe::API.trace('memcache', layer_kvs || {}, :get_multi) do begin info_kvs = {} - info_kvs[:KVKeyCount] = keys.flatten.length + info_kvs[:KVKeyCount] = keys.flatten.length values = get_multi_without_oboe(keys, raw) - + info_kvs[:KVHitCount] = values.length info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcached][:collect_backtraces] Oboe::API.log('memcache', 'info', info_kvs) rescue values = get_multi_without_oboe(keys, raw) end - values + values end else get_multi_without_oboe(keys, raw) end end @@ -84,10 +84,10 @@ if defined?(::Memcached) and Oboe::Config[:memcached][:enabled] ::Memcached.class_eval do include Oboe::Inst::Memcached end - + if defined?(::Memcached::Rails) ::Memcached::Rails.class_eval do include Oboe::Inst::MemcachedRails end end