Class: ScoutApm::ServerIntegrations::Passenger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Passenger

Returns a new instance of Passenger.



6
7
8
# File 'lib/scout_apm/server_integrations/passenger.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/passenger.rb', line 4

def logger
  @logger
end

Instance Method Details

#forking?Boolean

Returns:

  • (Boolean)


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

def forking?; true; end

#found?Boolean

Returns:

  • (Boolean)


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

def found?
  true
end

#installObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/scout_apm/server_integrations/passenger.rb', line 20

def install
  logger.info "Installing Passenger worker loop."

  PhusionPassenger.on_event(:starting_worker_process) do |forked|
    logger.debug "Passenger is starting a worker process. Starting worker thread."
    ScoutApm::Agent.instance.start_background_worker
  end

  # The agent's at_exit hook doesn't run when a Passenger process stops.
  # This does run when a process stops.
  PhusionPassenger.on_event(:stopping_worker_process) do
    logger.debug "Passenger is stopping a worker process, shutting down the agent."
    ScoutApm::Agent.instance.stop_background_worker
  end
end

#nameObject



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

def name
  :passenger
end

#present?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/scout_apm/server_integrations/passenger.rb', line 16

def present?
  (defined?(::Passenger) && defined?(::Passenger::AbstractServer)) || defined?(::PhusionPassenger)
end