Permalink
Browse files

Add additional logging to debug case 28914

  • Loading branch information...
benweint committed Mar 7, 2013
1 parent cdc6672 commit 375508505a2860256e200ad51cfd43d80dc31c68
@@ -180,6 +180,7 @@ def record_transaction(duration_seconds, options={})
# connection, this tells me to only try it once so this method returns
# quickly if there is some kind of latency with the server.
def after_fork(options={})
+ NewRelic::Agent.logger.debug("in after_fork hook, options=#{options.inspect}")
@forked = true
Agent.config.apply_config(NewRelic::Agent::Configuration::ManualSource.new(options), 1)
@@ -57,20 +57,34 @@ def self.new(*args)
super(*args).extend NewRelic::Agent::Instrumentation::ResqueInstrumentationInstaller
end
end
-
+
+ class Resque::Worker
+ def run_hook_with_logging(name, *args)
+ ::NewRelic::Agent.logger.debug("Running Resque hook '#{name}' in #{$$}")
+ run_hook_without_logging(name, *args)
+ end
+
+ alias_method :run_hook_without_logging, :run_hook
+ alias_method :run_hook, :run_hook_with_logging
+ end
+
+ NewRelic::Agent.logger.debug("Installing Resque fork hooks, can_fork? = #{NewRelic::LanguageSupport.can_fork?.inspect}")
if NewRelic::LanguageSupport.can_fork?
::Resque.before_first_fork do
+ NewRelic::Agent.logger.debug("In default Resque before_first_fork hook")
NewRelic::Agent.manual_start(:dispatcher => :resque,
:sync_startup => true,
:start_channel_listener => true,
:report_instance_busy => false)
end
-
+
::Resque.before_fork do |job|
+ NewRelic::Agent.logger.debug("In default Resque before_fork hook")
NewRelic::Agent.register_report_channel(job.object_id)
end
-
+
::Resque.after_fork do |job|
+ NewRelic::Agent.logger.debug("In default Resque after_fork hook")
NewRelic::Agent.after_fork(:report_to_channel => job.object_id)
end
end
@@ -11,6 +11,7 @@ module PipeChannelManager
extend self
def register_report_channel(id)
+ NewRelic::Agent.logger.debug("Registering report channel with id=#{id}, listener started? = #{listener.started?.inspect}")
listener.register_pipe(id)
end

0 comments on commit 3755085

Please sign in to comment.