def notice_agent_error(exception)
return unless exception.class < NewRelic::Agent::InternalAgentError
NewRelic::Agent.logger.info(exception)
@lock.synchronize do
return if @errors.any? { |err| err.exception_class_name == exception.class.name }
trace = exception.backtrace || caller.dup
noticed_error = NewRelic::NoticedError.new("NewRelic/AgentError", exception)
noticed_error.stack_trace = trace
@errors << noticed_error
end
rescue => e
NewRelic::Agent.logger.info("Unable to capture internal agent error due to an exception:", e)
end