lib/oboe/inst/memcache.rb in oboe-2.7.1.7-java vs lib/oboe/inst/memcache.rb in oboe-2.7.2.fuchs1

- old
+ new

@@ -5,27 +5,26 @@ module Inst module MemCache include Oboe::API::Memcache def self.included(cls) - Oboe.logger.info "[oboe/loading] Instrumenting memcache" if Oboe::Config[:verbose] + Oboe.logger.info '[oboe/loading] Instrumenting memcache' if Oboe::Config[:verbose] cls.class_eval do - MEMCACHE_OPS.reject { |m| not method_defined?(m) }.each do |m| + MEMCACHE_OPS.reject { |m| !method_defined?(m) }.each do |m| define_method("#{m}_with_oboe") do |*args| report_kvs = { :KVOp => m } report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces] if Oboe.tracing? Oboe::API.trace('memcache', report_kvs) do - result = send("#{m}_without_oboe", *args) + send("#{m}_without_oboe", *args) end else - result = send("#{m}_without_oboe", *args) + send("#{m}_without_oboe", *args) end - result end class_eval "alias #{m}_without_oboe #{m}" class_eval "alias #{m} #{m}_with_oboe" end @@ -57,22 +56,22 @@ rescue StandardError => e Oboe.logger.debug "[oboe/debug] Error collecting info keys: #{e.message}" Oboe.logger.debug e.backtrace end - Oboe::API.trace('memcache', {:KVOp => :get_multi}, :get_multi) do + Oboe::API.trace('memcache', { :KVOp => :get_multi }, :get_multi) do values = get_multi_without_oboe(args) info_kvs[:KVHitCount] = values.length Oboe::API.log('memcache', 'info', info_kvs) values end end def request_setup_with_oboe(*args) - if Oboe.tracing? and not Oboe.tracing_layer_op?(:get_multi) + if Oboe.tracing? && !Oboe.tracing_layer_op?(:get_multi) server, cache_key = request_setup_without_oboe(*args) info_kvs = { :KVKey => cache_key, :RemoteHost => server.host } info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces] Oboe::API.log('memcache', 'info', info_kvs) @@ -90,16 +89,14 @@ info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces] Oboe::API.log('memcache', 'info', info_kvs) result end - end # module MemCache end # module Inst end # module Oboe -if defined?(::MemCache) and Oboe::Config[:memcache][:enabled] +if defined?(::MemCache) && Oboe::Config[:memcache][:enabled] ::MemCache.class_eval do include Oboe::Inst::MemCache end end -