class ScoutApm::ServerIntegrations::Thin

Attributes

logger[R]

Public Class Methods

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

Public Instance Methods

forking?() click to toggle source
# File lib/scout_apm/server_integrations/thin.rb, line 14
def forking?; false; end
found?() click to toggle source
# File lib/scout_apm/server_integrations/thin.rb, line 39
def found?
  true
end
install() click to toggle source

TODO: What does it mean to install on a non-forking env?

# File lib/scout_apm/server_integrations/thin.rb, line 36
def install
end
name() click to toggle source
# File lib/scout_apm/server_integrations/thin.rb, line 10
def name
  :thin
end
present?() click to toggle source
# File lib/scout_apm/server_integrations/thin.rb, line 16
def present?
  found_thin = false

  # This code block detects when thin is run as:
  # `thin start`
  if defined?(::Thin) && defined?(::Thin::Server)
    # Ensure Thin is actually initialized. It could just be required and not running.
    ObjectSpace.each_object(::Thin::Server) { |x| found_thin = true }
  end

  # This code block detects when thin is run as:
  # `rails server`
  if defined?(::Rails::Server)
    ObjectSpace.each_object(::Rails::Server) { |x| found_thin ||= (x.instance_variable_get(:@_server).to_s == "Rack::Handler::Thin") }
  end

  found_thin
end