From 64670f272a2a5df423135c391ddc8789c959b615 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 27 Apr 2018 15:45:28 +0100 Subject: [PATCH 1/2] stop OpRangeNotAvailable errors going to sentry --- services/document-updater/app/coffee/DispatchManager.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/document-updater/app/coffee/DispatchManager.coffee b/services/document-updater/app/coffee/DispatchManager.coffee index e60d226660..58220be8ee 100644 --- a/services/document-updater/app/coffee/DispatchManager.coffee +++ b/services/document-updater/app/coffee/DispatchManager.coffee @@ -2,6 +2,7 @@ Settings = require('settings-sharelatex') logger = require('logger-sharelatex') Keys = require('./UpdateKeys') redis = require("redis-sharelatex") +Errors = require("./Errors") UpdateManager = require('./UpdateManager') Metrics = require('./Metrics') @@ -23,7 +24,9 @@ module.exports = DispatchManager = # Dispatch this in the background backgroundTask = (cb) -> UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) -> - logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" if error? + # log everything except OpRangeNotAvailable errors, these are normal + if error? and not (error instanceof Errors.OpRangeNotAvailableError) + logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" cb() RateLimiter.run backgroundTask, callback From 37f431f14867858f5e60de6889c3dd86d7977ebf Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 27 Apr 2018 16:03:46 +0100 Subject: [PATCH 2/2] also block "delete component" messages from sentry --- .../document-updater/app/coffee/DispatchManager.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/document-updater/app/coffee/DispatchManager.coffee b/services/document-updater/app/coffee/DispatchManager.coffee index 58220be8ee..0274901bf1 100644 --- a/services/document-updater/app/coffee/DispatchManager.coffee +++ b/services/document-updater/app/coffee/DispatchManager.coffee @@ -25,8 +25,13 @@ module.exports = DispatchManager = backgroundTask = (cb) -> UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) -> # log everything except OpRangeNotAvailable errors, these are normal - if error? and not (error instanceof Errors.OpRangeNotAvailableError) - logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" + if error? + # downgrade OpRangeNotAvailable and "Delete component" errors so they are not sent to sentry + logAsWarning = (error instanceof Errors.OpRangeNotAvailableError) || error.message?.match(/^Delete component/) + if logAsWarning + logger.warn err: error, project_id: project_id, doc_id: doc_id, "error processing update" + else + logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" cb() RateLimiter.run backgroundTask, callback