class ScoutApm::ServerIntegrations::Puma

Attributes

logger[R]

Public Class Methods

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

Public Instance Methods

forking?() click to toggle source
# File lib/scout_apm/server_integrations/puma.rb, line 14
def forking?
  return false unless defined?(::Puma)
  options = ::Puma.cli_config.instance_variable_get(:@options)
  options[:preload_app]
rescue
  false
end
found?() click to toggle source
# File lib/scout_apm/server_integrations/puma.rb, line 38
def found?
  true
end
install() click to toggle source
# File lib/scout_apm/server_integrations/puma.rb, line 26
def install
  old = ::Puma.cli_config.options[:before_worker_boot] || []
  new = Array(old) + [Proc.new do
    logger.info "Installing Puma worker loop."
    ScoutApm::Agent.instance.start_background_worker
  end]

  ::Puma.cli_config.options[:before_worker_boot] = new
rescue
  logger.warn "Unable to install Puma worker loop: #{$!.message}"
end
name() click to toggle source
# File lib/scout_apm/server_integrations/puma.rb, line 10
def name
  :puma
end
present?() click to toggle source
# File lib/scout_apm/server_integrations/puma.rb, line 22
def present?
  defined?(::Puma) && (File.basename($0) =~ /\Apuma/)
end