add comments for redis metrics

This commit is contained in:
Brian Gough 2020-04-02 11:33:52 +01:00
parent 21824d49da
commit 2b72ec49a1

View file

@ -41,6 +41,7 @@ module.exports = RedisManager =
logger.error {err: error, doc_id: doc_id, docLines: docLines}, error.message logger.error {err: error, doc_id: doc_id, docLines: docLines}, error.message
return callback(error) return callback(error)
docHash = RedisManager._computeHash(docLines) docHash = RedisManager._computeHash(docLines)
# record bytes sent to redis
metrics.summary "redis.docLines", docLines.length, {status: "set"} metrics.summary "redis.docLines", docLines.length, {status: "set"}
logger.log {project_id, doc_id, version, docHash, pathname, projectHistoryId}, "putting doc in redis" logger.log {project_id, doc_id, version, docHash, pathname, projectHistoryId}, "putting doc in redis"
RedisManager._serializeRanges ranges, (error, ranges) -> RedisManager._serializeRanges ranges, (error, ranges) ->
@ -90,6 +91,7 @@ module.exports = RedisManager =
return callback(error) if error? return callback(error) if error?
length = response?[0] length = response?[0]
if length > 0 if length > 0
# record bytes freed in redis
metrics.summary "redis.docLines", length, {status: "del"} metrics.summary "redis.docLines", length, {status: "del"}
multi = rclient.multi() multi = rclient.multi()
multi.srem keys.docsInProject(project_id:project_id), doc_id multi.srem keys.docsInProject(project_id:project_id), doc_id