Module: Oboe::Inst::Dalli
- Includes:
- API::Memcache
- Defined in:
- lib/oboe/frameworks/rails/inst/dalli.rb
Constant Summary
API::Memcache::MEMCACHE_OPS
Class Method Summary
collapse
Instance Method Summary
collapse
#memcache_hit?, #remote_host
Class Method Details
.included(cls) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/oboe/frameworks/rails/inst/dalli.rb', line 9
def self.included(cls)
cls.class_eval do
puts "[oboe/loading] Instrumenting Memcache (Dalli)" if Oboe::Config[:verbose]
if ::Dalli::Client.private_method_defined? :perform
alias perform_without_oboe perform
alias perform perform_with_oboe
else puts "[oboe/loading] Couldn't properly instrument Memcache (Dalli). Partial traces may occur."
end
end
end
|
Instance Method Details
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/oboe/frameworks/rails/inst/dalli.rb', line 20
def perform_with_oboe(op, key, *args)
if Oboe::Config.tracing?
opts = {}
opts[:KVOp] = op
opts[:KVKey] = key
Oboe::API.trace('memcache', opts || {}) do
result = perform_without_oboe(op, key, *args)
if op == :get and key.class == String
Oboe::API.log('memcache', 'info', { :KVHit => memcache_hit?(result) })
end
result
end
else
perform_without_oboe(op, key, *args)
end
end
|