class ElasticAPM::Spies::SidekiqSpy
@api private
def self.name_for(job)
def self.name_for(job) klass = job['class'] case klass when ACTIVE_JOB_WRAPPER job['wrapped'] else klass end end
def install
def install install_processor install_middleware end
def install_middleware
def install_middleware Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add Middleware end end end
def install_processor
def install_processor require 'sidekiq/processor' Sidekiq::Processor.class_eval do alias start_without_apm start alias terminate_without_apm terminate def start result = start_without_apm # Already running from Railtie if Rails if ElasticAPM.running? ElasticAPM.agent.config.logger = Sidekiq.logger else ElasticAPM.start end result end def terminate terminate_without_apm ElasticAPM.stop end end end
def start
def start result = start_without_apm # Already running from Railtie if Rails if ElasticAPM.running? ElasticAPM.agent.config.logger = Sidekiq.logger else ElasticAPM.start end result end
def terminate
def terminate terminate_without_apm ElasticAPM.stop end