Module: TraceView::Inst::MemcachedRails
- Defined in:
- lib/traceview/inst/memcached.rb
Overview
module Memcached
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(cls) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# 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 |
Instance Method Details
#get_multi_with_traceview(keys, raw = false) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# 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 |