mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Upgrade metrics
This commit is contained in:
parent
c9a9ab93ec
commit
e67c546254
3 changed files with 15 additions and 2 deletions
|
@ -9,7 +9,6 @@ db = mongojs(Settings.mongo.url, ['notifications'])
|
|||
Path = require("path")
|
||||
metrics = require("metrics-sharelatex")
|
||||
metrics.initialize("notifications")
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
||||
metrics.memory.monitor(logger)
|
||||
|
||||
HealthCheckController = require("./app/js/HealthCheckController")
|
||||
|
|
|
@ -3,8 +3,9 @@ logger = require('logger-sharelatex')
|
|||
mongojs = require('mongojs')
|
||||
db = mongojs(Settings.mongo?.url, ['notifications'])
|
||||
ObjectId = require("mongojs").ObjectId
|
||||
metrics = require('metrics-sharelatex')
|
||||
|
||||
module.exports =
|
||||
module.exports = Notifications =
|
||||
|
||||
getUserNotifications: (user_id, callback = (err, notifications)->)->
|
||||
query =
|
||||
|
@ -79,3 +80,15 @@ module.exports =
|
|||
searchOps =
|
||||
key: notification_key
|
||||
db.notifications.remove searchOps, {justOne: true}, callback
|
||||
|
||||
|
||||
metrics.timeAsyncMethod(
|
||||
Notifications, 'getUserNotifications',
|
||||
'Notifications.getUserNotifications',
|
||||
logger
|
||||
)
|
||||
metrics.timeAsyncMethod(
|
||||
Notifications, 'addNotification',
|
||||
'Notifications.addNotification',
|
||||
logger
|
||||
)
|
||||
|
|
|
@ -36,6 +36,7 @@ describe 'Notifications Tests', ->
|
|||
}
|
||||
'settings-sharelatex': {}
|
||||
'mongojs':@mongojs
|
||||
'metrics-sharelatex': {timeAsyncMethod: sinon.stub()}
|
||||
|
||||
@stubbedNotification = {user_id: ObjectId(user_id), key:"notification-key", messageOpts:"some info", templateKey:"template-key"}
|
||||
@stubbedNotificationArray = [@stubbedNotification]
|
||||
|
|
Loading…
Reference in a new issue