Class: ScoutApm::BackgroundJobIntegrations::Shoryuken
- Inherits:
-
Object
- Object
- ScoutApm::BackgroundJobIntegrations::Shoryuken
- Defined in:
- lib/scout_apm/background_job_integrations/shoryuken.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #add_middleware ⇒ Object
- #forking? ⇒ Boolean
- #install ⇒ Object
- #install_processor ⇒ Object
- #install_tracer ⇒ Object
- #name ⇒ Object
- #present? ⇒ Boolean
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 4 def logger @logger end |
Instance Method Details
#add_middleware ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 31 def add_middleware ::Shoryuken.configure_server do |config| config.server_middleware do |chain| chain.add ShoryukenMiddleware end end end |
#forking? ⇒ Boolean
14 15 16 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 14 def forking? false end |
#install ⇒ Object
18 19 20 21 22 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 18 def install install_tracer add_middleware install_processor end |
#install_processor ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 39 def install_processor require 'shoryuken/processor' # sidekiq v4 has not loaded this file by this point ::Shoryuken::Processor.class_eval do def initialize_with_scout(*args) agent = ::ScoutApm::Agent.instance agent.start initialize_without_scout(*args) end alias_method :initialize_without_scout, :initialize alias_method :initialize, :initialize_with_scout end end |
#install_tracer ⇒ Object
24 25 26 27 28 29 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 24 def install_tracer # ScoutApm::Tracer is not available when this class is defined ShoryukenMiddleware.class_eval do include ScoutApm::Tracer end end |
#name ⇒ Object
6 7 8 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 6 def name :shoryuken end |
#present? ⇒ Boolean
10 11 12 |
# File 'lib/scout_apm/background_job_integrations/shoryuken.rb', line 10 def present? defined?(::Shoryuken) && File.basename($PROGRAM_NAME).start_with?('shoryuken') end |