mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add metrics for migration
This commit is contained in:
parent
a2e63d009e
commit
97cbf46160
2 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ logger = require "logger-sharelatex"
|
||||||
Settings = require "settings-sharelatex"
|
Settings = require "settings-sharelatex"
|
||||||
redis = require("redis-sharelatex")
|
redis = require("redis-sharelatex")
|
||||||
LockManager = require("./LockManager")
|
LockManager = require("./LockManager")
|
||||||
|
metrics = require "./Metrics"
|
||||||
async = require("async")
|
async = require("async")
|
||||||
|
|
||||||
# The aim is to migrate the project history queues
|
# The aim is to migrate the project history queues
|
||||||
|
@ -89,6 +90,7 @@ class Multi
|
||||||
@queueKey = null
|
@queueKey = null
|
||||||
rpush: (args...) ->
|
rpush: (args...) ->
|
||||||
@queueKey = args[0]
|
@queueKey = args[0]
|
||||||
|
@updates_count = args.length - 1
|
||||||
@command_list.push { command:'rpush', args: args}
|
@command_list.push { command:'rpush', args: args}
|
||||||
setnx: (args...) ->
|
setnx: (args...) ->
|
||||||
@command_list.push { command: 'setnx', args: args}
|
@command_list.push { command: 'setnx', args: args}
|
||||||
|
@ -103,6 +105,9 @@ class Multi
|
||||||
callback(args...)
|
callback(args...)
|
||||||
@migrationClient.findQueue @queueKey, (err, rclient) =>
|
@migrationClient.findQueue @queueKey, (err, rclient) =>
|
||||||
return releaseLock(err) if err?
|
return releaseLock(err) if err?
|
||||||
|
# add metric for updates
|
||||||
|
dest = (if rclient == @rclient_new then "new" else "old")
|
||||||
|
metrics.count "migration", @updates_count, 1, {status: "#{@migrationClient.migration_phase}-#{dest}"}
|
||||||
multi = rclient.multi()
|
multi = rclient.multi()
|
||||||
for entry in @command_list
|
for entry in @command_list
|
||||||
multi[entry.command](entry.args...)
|
multi[entry.command](entry.args...)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"logger-sharelatex": "^1.7.0",
|
"logger-sharelatex": "^1.7.0",
|
||||||
"lynx": "0.0.11",
|
"lynx": "0.0.11",
|
||||||
"metrics-sharelatex": "^2.2.0",
|
"metrics-sharelatex": "^2.4.0",
|
||||||
"mongojs": "^2.6.0",
|
"mongojs": "^2.6.0",
|
||||||
"redis-sharelatex": "^1.0.11",
|
"redis-sharelatex": "^1.0.11",
|
||||||
"request": "2.47.0",
|
"request": "2.47.0",
|
||||||
|
|
Loading…
Reference in a new issue