Class: ElasticAPM::Spies::SidekiqSpy Private
- Inherits:
 - 
      Object
      
        
- Object
 - ElasticAPM::Spies::SidekiqSpy
 
 
- Defined in:
 - lib/elastic_apm/spies/sidekiq.rb
 
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Middleware
Constant Summary collapse
- ACTIVE_JOB_WRAPPER =
          
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper'.freeze
Class Method Summary collapse
- .name_for(job) ⇒ Object private
 
Instance Method Summary collapse
- 
  
    
      #install  ⇒ Object 
    
    
  
  
  
  
  
  
  
  private
  
    
rubocop:enable Metrics/MethodLength.
 - #install_middleware ⇒ Object private
 - 
  
    
      #install_processor  ⇒ Object 
    
    
  
  
  
  
  
  
  
  private
  
    
rubocop:disable Metrics/MethodLength.
 
Class Method Details
.name_for(job) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      32 33 34 35 36 37 38 39 40 41  | 
    
      # 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  | 
  
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:enable Metrics/MethodLength
      81 82 83 84  | 
    
      # File 'lib/elastic_apm/spies/sidekiq.rb', line 81 def install install_processor install_middleware end  | 
  
#install_middleware ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      43 44 45 46 47 48 49  | 
    
      # 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 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Metrics/MethodLength
      52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78  | 
    
      # 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  |