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
47e501ba2c
commit
f58f256864
3 changed files with 57 additions and 2 deletions
|
@ -2,6 +2,8 @@ mongojs = require "../../mongojs"
|
|||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
async = require "async"
|
||||
metrics = require 'metrics-sharelatex'
|
||||
logger = require 'logger-sharelatex'
|
||||
|
||||
module.exports = MessageManager =
|
||||
createMessage: (room_id, user_id, content, timestamp, callback = (error, message) ->) ->
|
||||
|
@ -63,3 +65,29 @@ module.exports = MessageManager =
|
|||
query._id = ObjectId(query._id)
|
||||
return query
|
||||
|
||||
|
||||
metrics.timeAsyncMethod(
|
||||
MessageManager, 'createMessage',
|
||||
'MessageManager.createMessage',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MessageManager, 'getMessages',
|
||||
'MessageManager.getMessages',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MessageManager, 'findAllMessagesInRooms',
|
||||
'MessageManager.findAllMessagesInRooms',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MessageManager, 'updateMessage',
|
||||
'MessageManager.updateMessage',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
MessageManager, 'deleteMessage',
|
||||
'MessageManager.deleteMessage',
|
||||
logger
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
mongojs = require("../../mongojs")
|
||||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
logger = require('logger-sharelatex')
|
||||
metrics = require('metrics-sharelatex')
|
||||
|
||||
module.exports = ThreadManager =
|
||||
GLOBAL_THREAD: "GLOBAL"
|
||||
|
@ -74,3 +76,30 @@ module.exports = ThreadManager =
|
|||
}, (error) ->
|
||||
return callback(error) if error?
|
||||
return callback null, room._id
|
||||
|
||||
|
||||
metrics.timeAsyncMethod(
|
||||
ThreadManager, 'findOrCreateThread',
|
||||
'ThreadManager.findOrCreateThread',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
ThreadManager, 'findAllThreadRooms',
|
||||
'ThreadManager.findAllThreadRooms',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
ThreadManager, 'resolveThread',
|
||||
'ThreadManager.resolveThread',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
ThreadManager, 'reopenThread',
|
||||
'ThreadManager.reopenThread',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
ThreadManager, 'deleteThread',
|
||||
'ThreadManager.deleteThread',
|
||||
logger
|
||||
)
|
||||
|
|
|
@ -8,8 +8,6 @@ app = express()
|
|||
server = require("http").createServer(app)
|
||||
Router = require "./router"
|
||||
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/../../node_modules/mongojs/node_modules/mongodb"), logger)
|
||||
|
||||
app.use express.bodyParser()
|
||||
app.use metrics.http.monitor(logger)
|
||||
|
||||
|
|
Loading…
Reference in a new issue