class ElasticAPM::Spies::SidekiqSpy
@api private
Constants
- ACTIVE_JOB_WRAPPER
Public Class Methods
name_for(job)
click to toggle source
# File lib/elastic_apm/spies/sidekiq.rb, line 32 def self.name_for(job) klass = job['class'] case klass when ACTIVE_JOB_WRAPPER job['wrapped'] else klass end end
Public Instance Methods
install()
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/elastic_apm/spies/sidekiq.rb, line 81 def install install_processor install_middleware end
install_middleware()
click to toggle source
# File lib/elastic_apm/spies/sidekiq.rb, line 43 def install_middleware Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add Middleware end end end
install_processor()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/elastic_apm/spies/sidekiq.rb, line 52 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
start()
click to toggle source
# File lib/elastic_apm/spies/sidekiq.rb, line 59 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
terminate()
click to toggle source
# File lib/elastic_apm/spies/sidekiq.rb, line 72 def terminate terminate_without_apm ElasticAPM.stop end