mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Upgrade metrics
This commit is contained in:
parent
a565939548
commit
64fc6ef2e3
3 changed files with 18 additions and 3 deletions
|
@ -9,7 +9,6 @@ Path = require "path"
|
||||||
|
|
||||||
Metrics.initialize("contacts")
|
Metrics.initialize("contacts")
|
||||||
logger.initialize("contacts")
|
logger.initialize("contacts")
|
||||||
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
|
||||||
Metrics.event_loop?.monitor(logger)
|
Metrics.event_loop?.monitor(logger)
|
||||||
|
|
||||||
app = express()
|
app = express()
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{db, ObjectId} = require "./mongojs"
|
{db, ObjectId} = require "./mongojs"
|
||||||
|
logger = require('logger-sharelatex')
|
||||||
|
metrics = require('metrics-sharelatex')
|
||||||
|
|
||||||
module.exports = ContactManager =
|
module.exports = ContactManager =
|
||||||
touchContact: (user_id, contact_id, callback = (error) ->) ->
|
touchContact: (user_id, contact_id, callback = (error) ->) ->
|
||||||
|
@ -28,3 +30,15 @@ module.exports = ContactManager =
|
||||||
}, (error, user) ->
|
}, (error, user) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
callback null, user?.contacts
|
callback null, user?.contacts
|
||||||
|
|
||||||
|
metrics.timeAsyncMethod(
|
||||||
|
ContactManager, 'touchContact',
|
||||||
|
'ContactManager.touchContact',
|
||||||
|
logger
|
||||||
|
)
|
||||||
|
|
||||||
|
metrics.timeAsyncMethod(
|
||||||
|
ContactManager, 'getContacts',
|
||||||
|
'ContactManager.getContacts',
|
||||||
|
logger
|
||||||
|
)
|
||||||
|
|
|
@ -14,7 +14,9 @@ describe "ContactManager", ->
|
||||||
"./mongojs": {
|
"./mongojs": {
|
||||||
db: @db = contacts: {}
|
db: @db = contacts: {}
|
||||||
ObjectId: ObjectId
|
ObjectId: ObjectId
|
||||||
}
|
},
|
||||||
|
'logger-sharelatex': {log: sinon.stub()},
|
||||||
|
'metrics-sharelatex': {timeAsyncMethod: sinon.stub()}
|
||||||
@user_id = ObjectId().toString()
|
@user_id = ObjectId().toString()
|
||||||
@contact_id = ObjectId().toString()
|
@contact_id = ObjectId().toString()
|
||||||
@callback = sinon.stub()
|
@callback = sinon.stub()
|
||||||
|
|
Loading…
Reference in a new issue