class ScoutApm::Instruments::Memcached
Attributes
Public Class Methods
Source
# File lib/scout_apm/instruments/memcached.rb, line 6 def initialize(context) @context = context @installed = false end
Public Instance Methods
Source
# File lib/scout_apm/instruments/memcached.rb, line 19 def install(prepend:) if defined?(::Dalli) && defined?(::Dalli::Client) @installed = true logger.info "Instrumenting Memcached. Prepend: #{prepend}" if prepend ::Dalli::Client.send(:include, ScoutApm::Tracer) ::Dalli::Client.send(:prepend, MemcachedInstrumentationPrepend) else ::Dalli::Client.class_eval do include ScoutApm::Tracer def perform_with_scout_instruments(*args, &block) command = args.first rescue "Unknown" self.class.instrument("Memcached", command) do perform_without_scout_instruments(*args, &block) end end alias_method :perform_without_scout_instruments, :perform alias_method :perform, :perform_with_scout_instruments end end end end
Source
# File lib/scout_apm/instruments/memcached.rb, line 15 def installed? @installed end
Source
# File lib/scout_apm/instruments/memcached.rb, line 11 def logger context.logger end
Source
# File lib/scout_apm/instruments/memcached.rb, line 32 def perform_with_scout_instruments(*args, &block) command = args.first rescue "Unknown" self.class.instrument("Memcached", command) do perform_without_scout_instruments(*args, &block) end end