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'
ACTIVE_JOB_WRAPPER_V8 =

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.

'Sidekiq::ActiveJob::Wrapper'

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.



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

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

  case klass
  when ACTIVE_JOB_WRAPPER, ACTIVE_JOB_WRAPPER_V8
    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.



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

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.



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

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.



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

def install_processor
  require 'sidekiq/processor'

  Sidekiq::Processor.prepend(Ext)
end