Class: ScoutApm::ServerIntegrations::Unicorn
- Inherits:
-
Object
- Object
- ScoutApm::ServerIntegrations::Unicorn
- Defined in:
- lib/scout_apm/server_integrations/unicorn.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #forking? ⇒ Boolean
- #found? ⇒ Boolean
-
#initialize(logger) ⇒ Unicorn
constructor
A new instance of Unicorn.
- #install ⇒ Object
- #name ⇒ Object
- #present? ⇒ Boolean
Constructor Details
#initialize(logger) ⇒ Unicorn
Returns a new instance of Unicorn.
6 7 8 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 6 def initialize(logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 4 def logger @logger end |
Instance Method Details
#forking? ⇒ Boolean
14 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 14 def forking?; true; end |
#found? ⇒ Boolean
34 35 36 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 34 def found? true end |
#install ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 24 def install ::Unicorn::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 ⇒ Object
10 11 12 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 10 def name :unicorn end |
#present? ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/scout_apm/server_integrations/unicorn.rb', line 16 def present? if defined?(::Unicorn) && defined?(::Unicorn::HttpServer) # Ensure Unicorn is actually initialized. It could just be required and not running. ObjectSpace.each_object(::Unicorn::HttpServer) { |x| return true } false end end |