Module: Instana::Instrumentation::Dalli
- Defined in:
- lib/instana/instrumentation/dalli.rb
Instance Method Summary collapse
Instance Method Details
#get_multi(*keys) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/instana/instrumentation/dalli.rb', line 37 def get_multi(*keys) entry_payload = { :memcache => {} } entry_payload[:memcache][:namespace] = [:namespace] if .key?(:namespace) entry_payload[:memcache][:command] = :get_multi entry_payload[:memcache][:keys] = keys.flatten.join(", ") ::Instana.tracer.log_entry(:memcache, entry_payload) exit_payload = { :memcache => {} } result = super(*keys) exit_payload[:memcache][:hits] = result.length result rescue => e exit_payload[:memcache][:error] = e. rescue nil ::Instana.tracer.log_error(e) raise ensure ::Instana.tracer.log_exit(:memcache, exit_payload) end |
#perform(*args, &blk) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/instana/instrumentation/dalli.rb', line 7 def perform(*args, &blk) if !::Instana.tracer.tracing? || ::Instana.tracer.tracing_span?(:memcache) do_skip = true return super(*args, &blk) end op, key, *_opts = args entry_payload = { :memcache => {} } entry_payload[:memcache][:namespace] = [:namespace] if .key?(:namespace) entry_payload[:memcache][:command] = op entry_payload[:memcache][:key] = key ::Instana.tracer.start_span(:memcache, attributes: entry_payload) exit_payload = { :memcache => {} } result = super(*args, &blk) if op == :get exit_payload[:memcache][:hit] = result ? 1 : 0 end result rescue => e exit_payload[:memcache][:error] = e. rescue nil ::Instana.tracer.log_error(e) raise ensure ::Instana.tracer.log_exit(:memcache, exit_payload) unless do_skip end |