mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Upgrade metrics
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user