module TraceView::Inst::MemcachedRails
Public Class Methods
included(cls)
click to toggle source
# File lib/traceview/inst/memcached.rb, line 44 def self.included(cls) cls.class_eval do if ::Memcached::Rails.method_defined? :get_multi alias get_multi_without_traceview get_multi alias get_multi get_multi_with_traceview elsif TraceView::Config[:verbose] TraceView.logger.warn '[traceview/loading] Couldn\'t properly instrument Memcached. Partial traces may occur.' end end end
Public Instance Methods
get_multi_with_traceview(keys, raw = false)
click to toggle source
# File lib/traceview/inst/memcached.rb, line 55 def get_multi_with_traceview(keys, raw = false) if TraceView.tracing? layer_kvs = {} layer_kvs[:KVOp] = :get_multi TraceView::API.trace(:memcache, layer_kvs || {}, :get_multi) do begin info_kvs = {} info_kvs[:KVKeyCount] = keys.flatten.length values = get_multi_without_traceview(keys, raw) info_kvs[:KVHitCount] = values.length info_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:memcached][:collect_backtraces] TraceView::API.log(:memcache, :info, info_kvs) rescue values = get_multi_without_traceview(keys, raw) end values end else get_multi_without_traceview(keys, raw) end end