Class: ScoutApm::ServerIntegrations::Thin

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/server_integrations/thin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Thin

Returns a new instance of Thin.



6
7
8
# File 'lib/scout_apm/server_integrations/thin.rb', line 6

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/scout_apm/server_integrations/thin.rb', line 4

def logger
  @logger
end

Instance Method Details

#forking?Boolean

Returns:

  • (Boolean)


14
# File 'lib/scout_apm/server_integrations/thin.rb', line 14

def forking?; false; end

#found?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/scout_apm/server_integrations/thin.rb', line 39

def found?
  true
end

#installObject

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



36
37
# File 'lib/scout_apm/server_integrations/thin.rb', line 36

def install
end

#nameObject



10
11
12
# File 'lib/scout_apm/server_integrations/thin.rb', line 10

def name
  :thin
end

#present?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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