Class: ScoutApm::BackgroundJobIntegrations::Sidekiq
- Inherits:
-
Object
- Object
- ScoutApm::BackgroundJobIntegrations::Sidekiq
- Defined in:
- lib/scout_apm/background_job_integrations/sidekiq.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 4 def logger @logger end |
Instance Method Details
#forking? ⇒ Boolean
14 15 16 |
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 14 def forking? true end |
#install ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 18 def install # ScoutApm::Tracer is not available when this class is defined SidekiqMiddleware.class_eval do include ScoutApm::Tracer end ::Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add SidekiqMiddleware end end require 'sidekiq/processor' # sidekiq v4 has not loaded this file by this point ::Sidekiq::Processor.class_eval do old = instance_method(:initialize) define_method(:initialize) do |boss| ScoutApm::Agent.instance.start_background_worker old.bind(self).call(boss) end end end |
#name ⇒ Object
6 7 8 |
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 6 def name :sidekiq end |
#present? ⇒ Boolean
10 11 12 |
# File 'lib/scout_apm/background_job_integrations/sidekiq.rb', line 10 def present? defined?(::Sidekiq) && (File.basename($0) =~ /\Asidekiq/) end |