add metrics for queue operations

This commit is contained in:
Brian Gough 2019-11-25 10:51:10 +00:00
parent 8b73bb9f13
commit 68e12f4d2d

View file

@ -259,9 +259,11 @@ module.exports = RedisManager =
# expire must come after rpush since before it will be a no-op if the list is empty
multi.expire keys.docOps(doc_id: doc_id), RedisManager.DOC_OPS_TTL # index 6
if projectHistoryType is "project-history"
logger.debug {doc_id}, "skipping push of uncompressed ops for project using project-history"
metrics.inc 'history-queue', 1, {status: 'skip-track-changes'}
logger.log {doc_id}, "skipping push of uncompressed ops for project using project-history"
else
# project is using old track-changes history service
metrics.inc 'history-queue', 1, {status: 'track-changes'}
multi.rpush historyKeys.uncompressedHistoryOps(doc_id: doc_id), jsonOps... # index 7
# Set the unflushed timestamp to the current time if the doc
# hasn't been modified before (the content in mongo has been
@ -282,6 +284,7 @@ module.exports = RedisManager =
docUpdateCount = result[7] # length of uncompressedHistoryOps queue (index 7)
if jsonOps.length > 0 && Settings.apis?.project_history?.enabled
metrics.inc 'history-queue', 1, {status: 'project-history'}
ProjectHistoryRedisManager.queueOps project_id, jsonOps..., (error, projectUpdateCount) ->
callback null, docUpdateCount, projectUpdateCount
else