Class: ElasticAPM::Spies::SidekiqSpy Private

Inherits:
Object
  • Object
show all
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

Modules: Ext 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'

Class Method Summary collapse

Instance Method Summary collapse

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.



49
50
51
52
53
54
55
56
57
58
# File 'lib/elastic_apm/spies/sidekiq.rb', line 49

def self.name_for(job)
  klass = job['class']

  case klass
  when ACTIVE_JOB_WRAPPER
    job['wrapped']
  else
    klass
  end
end

Instance Method Details

#installObject

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.



94
95
96
97
# File 'lib/elastic_apm/spies/sidekiq.rb', line 94

def install
  install_processor
  install_middleware
end

#install_middlewareObject

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.



60
61
62
63
64
65
66
# File 'lib/elastic_apm/spies/sidekiq.rb', line 60

def install_middleware
  Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add Middleware
    end
  end
end

#install_processorObject

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.



88
89
90
91
92
# File 'lib/elastic_apm/spies/sidekiq.rb', line 88

def install_processor
  require 'sidekiq/processor'

  Sidekiq::Processor.prepend(Ext)
end