add metric for project history queue

This commit is contained in:
Brian Gough 2020-03-25 12:15:16 +00:00
parent 33ff7f7c1b
commit e293d86c14

View file

@ -2,9 +2,13 @@ Settings = require('settings-sharelatex')
projectHistoryKeys = Settings.redis?.project_history?.key_schema projectHistoryKeys = Settings.redis?.project_history?.key_schema
rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater) rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
logger = require('logger-sharelatex') logger = require('logger-sharelatex')
metrics = require('./Metrics')
module.exports = ProjectHistoryRedisManager = module.exports = ProjectHistoryRedisManager =
queueOps: (project_id, ops..., callback = (error, projectUpdateCount) ->) -> queueOps: (project_id, ops..., callback = (error, projectUpdateCount) ->) ->
# Record metric for ops pushed onto queue
for op in ops
metrics.summary "redis.projectHistoryOps", op.length, {status: "push"}
multi = rclient.multi() multi = rclient.multi()
# Push the ops onto the project history queue # Push the ops onto the project history queue
multi.rpush projectHistoryKeys.projectHistoryOps({project_id}), ops... multi.rpush projectHistoryKeys.projectHistoryOps({project_id}), ops...