mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update to new metrics api
This commit is contained in:
parent
c30e672549
commit
fa7ee739bb
2 changed files with 8 additions and 12 deletions
|
@ -3,6 +3,7 @@ PackManager = require "./PackManager"
|
|||
async = require "async"
|
||||
_ = require "underscore"
|
||||
metrics = require 'metrics-sharelatex'
|
||||
logger = require 'logger-sharelatex'
|
||||
|
||||
module.exports = MongoManager =
|
||||
getLastCompressedUpdate: (doc_id, callback = (error, update) ->) ->
|
||||
|
@ -95,15 +96,9 @@ module.exports = MongoManager =
|
|||
db.docHistoryIndex.ensureIndex { project_id: 1 }, { background: true }
|
||||
|
||||
|
||||
metrics.timeAsyncMethod(
|
||||
MongoManager, 'getLastCompressedUpdate',
|
||||
'MongoManger.getLastCompressedUpdate'
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MongoManager, 'getProjectMetaData',
|
||||
'MongoManger.getProjectMetaData'
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MongoManager, 'setProjectMetaData',
|
||||
'MongoManger.setProjectMetaData'
|
||||
)
|
||||
[
|
||||
'getLastCompressedUpdate',
|
||||
'getProjectMetaData',
|
||||
'setProjectMetaData'
|
||||
].map (method) ->
|
||||
metrics.timeAsyncMethod(MongoManager, method, 'mongo.MongoManager', logger)
|
||||
|
|
|
@ -14,6 +14,7 @@ describe "MongoManager", ->
|
|||
@MongoManager = SandboxedModule.require modulePath, requires:
|
||||
"./mongojs" : { db: @db = {}, ObjectId: ObjectId }
|
||||
"./PackManager" : @PackManager = {}
|
||||
'metrics-sharelatex': {timeAsyncMethod: ()->}
|
||||
@callback = sinon.stub()
|
||||
@doc_id = ObjectId().toString()
|
||||
@project_id = ObjectId().toString()
|
||||
|
|
Loading…
Reference in a new issue