maintenance: log errors to rails log and newrelic.
This commit is contained in:
@@ -4,6 +4,8 @@ module Maintenance
|
|||||||
def hourly
|
def hourly
|
||||||
UploadErrorChecker.new.check!
|
UploadErrorChecker.new.check!
|
||||||
DelayedJobErrorChecker.new.check!
|
DelayedJobErrorChecker.new.check!
|
||||||
|
rescue Exception => exception
|
||||||
|
rescue_exception(exception)
|
||||||
end
|
end
|
||||||
|
|
||||||
def daily
|
def daily
|
||||||
@@ -24,6 +26,8 @@ module Maintenance
|
|||||||
TagChangeRequestPruner.warn_all
|
TagChangeRequestPruner.warn_all
|
||||||
TagChangeRequestPruner.reject_all
|
TagChangeRequestPruner.reject_all
|
||||||
Ban.prune!
|
Ban.prune!
|
||||||
|
rescue Exception => exception
|
||||||
|
rescue_exception(exception)
|
||||||
end
|
end
|
||||||
|
|
||||||
def weekly
|
def weekly
|
||||||
@@ -31,5 +35,18 @@ module Maintenance
|
|||||||
UserPasswordResetNonce.prune!
|
UserPasswordResetNonce.prune!
|
||||||
ApproverPruner.prune!
|
ApproverPruner.prune!
|
||||||
TagRelationshipRetirementService.find_and_retire!
|
TagRelationshipRetirementService.find_and_retire!
|
||||||
|
rescue Exception => exception
|
||||||
|
rescue_exception(exception)
|
||||||
|
end
|
||||||
|
|
||||||
|
def rescue_exception(exception)
|
||||||
|
backtrace = Rails.backtrace_cleaner.clean(exception.backtrace).join("\n")
|
||||||
|
Rails.logger.error("#{exception.class}: #{exception.message}\n#{backtrace}")
|
||||||
|
|
||||||
|
if defined?(NewRelic::Agent)
|
||||||
|
NewRelic::Agent.notice_error(exception, custom_params: { backtrace: backtrace })
|
||||||
|
end
|
||||||
|
|
||||||
|
raise exception
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user