class ScoutApm::ServerIntegrations::Rainbows

Attributes

logger[R]

Public Class Methods

new(logger) click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 6
def initialize(logger)
  @logger = logger
end

Public Instance Methods

forking?() click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 14
def forking?; true; end
found?() click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 35
def found?
  true
end
install() click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 23
def install
  logger.info "Installing Rainbows worker loop."

  Rainbows::HttpServer.class_eval do
    old = instance_method(:worker_loop)
    define_method(:worker_loop) do |worker|
      ScoutApm::Agent.instance.start_background_worker
      old.bind(self).call(worker)
    end
  end
end
name() click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 10
def name
  :rainbows
end
present?() click to toggle source
# File lib/scout_apm/server_integrations/rainbows.rb, line 16
def present?
  if defined?(::Rainbows) && defined?(::Rainbows::HttpServer)
    ObjectSpace.each_object(::Rainbows::HttpServer) { |x| return true }
    false
  end
end