lib/oboe/inst/memcache.rb in oboe-2.2.6 vs lib/oboe/inst/memcache.rb in oboe-2.3.2
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2012 by Tracelytics, Inc.
+# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.
module Oboe
module Inst
module MemCache
@@ -12,10 +12,11 @@
cls.class_eval do
MEMCACHE_OPS.reject { |m| not 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)
end
@@ -58,10 +59,11 @@
layer_kvs[:KVOp] = :get_multi
Oboe::API.trace('memcache', layer_kvs || {}, :get_multi) do
begin
info_kvs = {}
+ info_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:memcache][:collect_backtraces]
if args.last.is_a?(Hash) || args.last.nil?
info_kvs[:KVKeyCount] = args.flatten.length - 1
else
info_kvs[:KVKeyCount] = args.flatten.length
@@ -82,19 +84,26 @@
end
def request_setup_with_oboe(*args)
if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:get_multi)
server, cache_key = request_setup_without_oboe(*args)
- Oboe::API.log('memcache', 'info', { :KVKey => cache_key, :RemoteHost => server.host })
+
+ 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)
else
server, cache_key = request_setup_without_oboe(*args)
end
return [server, cache_key]
end
def cache_get_with_oboe(server, cache_key)
result = cache_get_without_oboe(server, cache_key)
- Oboe::API.log('memcache', 'info', { :KVHit => memcache_hit?(result) })
+
+ info_kvs = { :KVHit => memcache_hit?(result) }
+ 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