lib/agent/server/am_agent.rb in site24x7_apminsight-1.6.1 vs lib/agent/server/am_agent.rb in site24x7_apminsight-1.7.0
- old
+ new
@@ -88,10 +88,11 @@
def startConnect uri,data
resp = @obj.connector.post @obj.constants.connect_uri+uri,data
end
def doDispatcherActions
+ @obj.log.info "Dispatcher: #{@obj.config.app_dispatcher}"
case @obj.config.app_dispatcher
when 'passenger'
#starting a new process
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
@@ -105,9 +106,17 @@
# shutting down a process.
PhusionPassenger.on_event(:stopping_worker_process) do
ManageEngine::APMWorker.getInstance.stop
@obj.log.info "stopping_worker_process :Process ID :#{Process.pid} ----> #$$ "
end
+ when 'unicorn'
+ Unicorn::HttpServer.class_eval do
+ old_object = instance_method(:worker_loop)
+ define_method(:worker_loop) do |worker|
+ ::ManageEngine::APMObjectHolder.instance.agent.doCollect
+ old_object.bind(self).call(worker)
+ end
+ end
else#case
end#case
end
end#c