Merge branch 'sk-upgrade-metrics'

This commit is contained in:
Shane Kilkelly 2017-04-04 09:34:45 +01:00
commit 6a6fdc13a5
4 changed files with 19 additions and 4 deletions

View file

@ -9,7 +9,6 @@ Path = require "path"
Metrics.initialize("docstore") Metrics.initialize("docstore")
logger.initialize("docstore") logger.initialize("docstore")
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()

View file

@ -1,4 +1,6 @@
{db, ObjectId} = require "./mongojs" {db, ObjectId} = require "./mongojs"
logger = require 'logger-sharelatex'
metrics = require 'metrics-sharelatex'
module.exports = MongoManager = module.exports = MongoManager =
@ -68,3 +70,15 @@ module.exports = MongoManager =
}, { }, {
upsert: true upsert: true
}, callback }, callback
[
'findDoc',
'getProjectsDocs',
'getArchivedProjectDocs',
'upsertIntoDocCollection',
'markDocAsArchived',
'getDocVersion',
'setDocVersion'
].map (method) ->
metrics.timeAsyncMethod(MongoManager, method, 'mongo.MongoManager', logger)

View file

@ -10,7 +10,7 @@
"dependencies": { "dependencies": {
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0", "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.4.0", "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.4.0",
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.1.0", "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.7.1",
"mongojs": "0.18.2", "mongojs": "0.18.2",
"express": "~4.1.1", "express": "~4.1.1",
"underscore": "~1.6.0", "underscore": "~1.6.0",

View file

@ -11,6 +11,8 @@ describe "MongoManager", ->
"./mongojs": "./mongojs":
db: @db = { docs: {}, docOps: {} } db: @db = { docs: {}, docOps: {} }
ObjectId: ObjectId ObjectId: ObjectId
'metrics-sharelatex': {timeAsyncMethod: sinon.stub()}
'logger-sharelatex': {log: ()->}
@project_id = ObjectId().toString() @project_id = ObjectId().toString()
@doc_id = ObjectId().toString() @doc_id = ObjectId().toString()
@callback = sinon.stub() @callback = sinon.stub()