Remove the Metrics module, use metrics-sharelatex

This commit is contained in:
Shane Kilkelly 2017-04-03 16:18:30 +01:00
parent 49de7bf315
commit 043520fc28
50 changed files with 49 additions and 50 deletions

View file

@ -2,7 +2,7 @@ AuthenticationManager = require ("./AuthenticationManager")
LoginRateLimiter = require("../Security/LoginRateLimiter")
UserGetter = require "../User/UserGetter"
UserUpdater = require "../User/UserUpdater"
Metrics = require('../../infrastructure/Metrics')
Metrics = require('metrics-sharelatex')
logger = require("logger-sharelatex")
querystring = require('querystring')
Url = require("url")

View file

@ -1,6 +1,6 @@
User = require("../../models/User").User
logger = require 'logger-sharelatex'
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
module.exports = BetaProgramHandler =

View file

@ -1,4 +1,4 @@
Metrics = require "../../infrastructure/Metrics"
Metrics = require "metrics-sharelatex"
Project = require("../../models/Project").Project
CompileManager = require("./CompileManager")
ClsiManager = require("./ClsiManager")

View file

@ -6,7 +6,7 @@ Project = require("../../models/Project").Project
ProjectRootDocManager = require "../Project/ProjectRootDocManager"
UserGetter = require "../User/UserGetter"
ClsiManager = require "./ClsiManager"
Metrics = require('../../infrastructure/Metrics')
Metrics = require('metrics-sharelatex')
logger = require("logger-sharelatex")
rateLimiter = require("../../infrastructure/RateLimiter")

View file

@ -4,7 +4,7 @@ settings = require 'settings-sharelatex'
_ = require 'underscore'
async = require 'async'
logger = require('logger-sharelatex')
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
redis = require("redis-sharelatex")
rclient = redis.createClient(settings.redis.web)
Project = require("../../models/Project").Project

View file

@ -1,5 +1,5 @@
logger = require "logger-sharelatex"
Metrics = require "../../infrastructure/Metrics"
Metrics = require "metrics-sharelatex"
Project = require("../../models/Project").Project
ProjectZipStreamManager = require "./ProjectZipStreamManager"
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"

View file

@ -1,5 +1,5 @@
logger = require('logger-sharelatex')
Metrics = require('../../infrastructure/Metrics')
Metrics = require('metrics-sharelatex')
sanitize = require('sanitizer')
ProjectEntityHandler = require('../Project/ProjectEntityHandler')
ProjectOptionsHandler = require('../Project/ProjectOptionsHandler')

View file

@ -7,7 +7,7 @@ ProjectGetter = require('../Project/ProjectGetter')
UserGetter = require('../User/UserGetter')
AuthorizationManager = require("../Authorization/AuthorizationManager")
ProjectEditorHandler = require('../Project/ProjectEditorHandler')
Metrics = require('../../infrastructure/Metrics')
Metrics = require('metrics-sharelatex')
CollaboratorsHandler = require("../Collaborators/CollaboratorsHandler")
CollaboratorsInviteHandler = require("../Collaborators/CollaboratorsInviteHandler")
PrivilegeLevels = require "../Authorization/PrivilegeLevels"

View file

@ -1,5 +1,5 @@
logger = require('logger-sharelatex')
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
Settings = require('settings-sharelatex')
nodemailer = require("nodemailer")
sesTransport = require('nodemailer-ses-transport')

View file

@ -4,7 +4,7 @@ projectDeleter = require("./ProjectDeleter")
projectDuplicator = require("./ProjectDuplicator")
projectCreationHandler = require("./ProjectCreationHandler")
editorController = require("../Editor/EditorController")
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
User = require('../../models/User').User
TagsHandler = require("../Tags/TagsHandler")
SubscriptionLocator = require("../Subscription/SubscriptionLocator")

View file

@ -1,6 +1,6 @@
logger = require('logger-sharelatex')
async = require("async")
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
Settings = require('settings-sharelatex')
ObjectId = require('mongoose').Types.ObjectId
Project = require('../../models/Project').Project

View file

@ -1,5 +1,5 @@
mongojs = require("../../infrastructure/mongojs")
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
db = mongojs.db
ObjectId = mongojs.ObjectId
async = require "async"

View file

@ -2,7 +2,7 @@ tpdsUpdateHandler = require('./TpdsUpdateHandler')
UpdateMerger = require "./UpdateMerger"
logger = require('logger-sharelatex')
Path = require('path')
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
module.exports =
# mergeUpdate and deleteUpdate are used by Dropbox, where the project is only passed as the name, as the

View file

@ -3,7 +3,7 @@ logger = require('logger-sharelatex')
path = require('path')
Project = require('../../models/Project').Project
keys = require('../../infrastructure/Keys')
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
request = require("request")
CollaboratorsHandler = require('../Collaborators/CollaboratorsHandler')

View file

@ -1,6 +1,6 @@
child = require "child_process"
logger = require "logger-sharelatex"
metrics = require "../../infrastructure/Metrics"
metrics = require "metrics-sharelatex"
fs = require "fs"
Path = require "path"
_ = require("underscore")

View file

@ -1,5 +1,5 @@
logger = require "logger-sharelatex"
metrics = require "../../infrastructure/Metrics"
metrics = require "metrics-sharelatex"
fs = require "fs"
Path = require "path"
FileSystemImportManager = require "./FileSystemImportManager"

View file

@ -5,7 +5,7 @@ User = require("../../models/User").User
newsLetterManager = require('../Newsletter/NewsletterManager')
UserRegistrationHandler = require("./UserRegistrationHandler")
logger = require("logger-sharelatex")
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
Url = require("url")
AuthenticationManager = require("../Authentication/AuthenticationManager")
AuthenticationController = require('../Authentication/AuthenticationController')

View file

@ -1,7 +1,7 @@
User = require("../../models/User").User
UserLocator = require("./UserLocator")
logger = require("logger-sharelatex")
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
module.exports = UserCreator =

View file

@ -1,5 +1,5 @@
mongojs = require("../../infrastructure/mongojs")
metrics = require('../../infrastructure/Metrics')
metrics = require('metrics-sharelatex')
logger = require('logger-sharelatex')
db = mongojs.db
ObjectId = mongojs.ObjectId

View file

@ -1,5 +1,5 @@
mongojs = require("../../infrastructure/mongojs")
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
db = mongojs.db
ObjectId = mongojs.ObjectId
logger = require('logger-sharelatex')

View file

@ -1,6 +1,6 @@
logger = require("logger-sharelatex")
mongojs = require("../../infrastructure/mongojs")
metrics = require("../../infrastructure/Metrics")
metrics = require("metrics-sharelatex")
db = mongojs.db
ObjectId = mongojs.ObjectId
UserLocator = require("./UserLocator")

View file

@ -1,4 +1,4 @@
metrics = require('./Metrics')
metrics = require('metrics-sharelatex')
module.exports =
log: (req)->
if req.headers["user-agent"]?

View file

@ -1,4 +1,4 @@
metrics = require('./Metrics')
metrics = require('metrics-sharelatex')
Settings = require('settings-sharelatex')
redis = require("redis-sharelatex")
rclient = redis.createClient(Settings.redis.web)

View file

@ -1 +0,0 @@
module.exports = require("metrics-sharelatex")

View file

@ -1,5 +1,5 @@
_ = require('underscore')
metrics = require('./Metrics')
metrics = require('metrics-sharelatex')
do trackOpenSockets = ->
metrics.gauge("http.open-sockets", _.size(require('http').globalAgent.sockets.length), 0.5)

View file

@ -2,7 +2,7 @@ Path = require "path"
express = require('express')
Settings = require('settings-sharelatex')
logger = require 'logger-sharelatex'
metrics = require('./Metrics')
metrics = require('metrics-sharelatex')
crawlerLogger = require('./CrawlerLogger')
expressLocals = require('./ExpressLocals')
Router = require('../router')

View file

@ -9,7 +9,7 @@ Settings = require('settings-sharelatex')
TpdsController = require('./Features/ThirdPartyDataStore/TpdsController')
SubscriptionRouter = require './Features/Subscription/SubscriptionRouter'
UploadsRouter = require './Features/Uploads/UploadsRouter'
metrics = require('./infrastructure/Metrics')
metrics = require('metrics-sharelatex')
ReferalController = require('./Features/Referal/ReferalController')
AuthenticationController = require('./Features/Authentication/AuthenticationController')
TagsController = require("./Features/Tags/TagsController")

View file

@ -16,7 +16,7 @@ describe "AuthenticationController", ->
"./AuthenticationManager": @AuthenticationManager = {}
"../User/UserGetter" : @UserGetter = {}
"../User/UserUpdater" : @UserUpdater = {}
"../../infrastructure/Metrics": @Metrics = { inc: sinon.stub() }
"metrics-sharelatex": @Metrics = { inc: sinon.stub() }
"../Security/LoginRateLimiter": @LoginRateLimiter = { processLoginRequest:sinon.stub(), recordSuccessfulLogin:sinon.stub() }
"../User/UserHandler": @UserHandler = {setupLoginData:sinon.stub()}
"../Analytics/AnalyticsManager": @AnalyticsManager = { recordEvent: sinon.stub() }

View file

@ -26,7 +26,7 @@ describe 'BetaProgramHandler', ->
log: sinon.stub()
err: sinon.stub()
},
"../../infrastructure/Metrics": @logger = {
"metrics-sharelatex": @logger = {
inc: sinon.stub()
}

View file

@ -42,7 +42,7 @@ describe "CompileController", ->
"request": @request = sinon.stub()
"../../models/Project": Project: @Project = {}
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
"../../infrastructure/Metrics": @Metrics = { inc: sinon.stub() }
"metrics-sharelatex": @Metrics = { inc: sinon.stub() }
"./CompileManager":@CompileManager
"../User/UserGetter":@UserGetter
"./ClsiManager": @ClsiManager

View file

@ -23,7 +23,7 @@ describe "CompileManager", ->
"../User/UserGetter": @UserGetter = {}
"./ClsiManager": @ClsiManager = {}
"../../infrastructure/RateLimiter": @ratelimiter
"../../infrastructure/Metrics": @Metrics =
"metrics-sharelatex": @Metrics =
Timer: class Timer
done: sinon.stub()
inc: sinon.stub()

View file

@ -32,7 +32,7 @@ describe 'DocumentUpdaterHandler', ->
"../../models/Project": Project: @Project={}
'../../Features/Project/ProjectLocator':{}
'redis-sharelatex' : createClient: () => @rclient
"../../infrastructure/Metrics":
"metrics-sharelatex":
Timer:->
done:->

View file

@ -17,7 +17,7 @@ describe "ProjectDownloadsController", ->
@ProjectDownloadsController = SandboxedModule.require modulePath, requires:
"./ProjectZipStreamManager" : @ProjectZipStreamManager = {}
"../../models/Project" : Project: @Project = {}
"../../infrastructure/Metrics": @metrics = {}
"metrics-sharelatex": @metrics = {}
"logger-sharelatex" : @logger = {log: sinon.stub()}
"../DocumentUpdater/DocumentUpdaterHandler": @DocumentUpdaterHandler

View file

@ -64,7 +64,7 @@ describe "EditorController", ->
"settings-sharelatex":@settings
'../Dropbox/DropboxProjectLinker':@dropboxProjectLinker
'./EditorRealTimeController':@EditorRealTimeController = {}
"../../infrastructure/Metrics": @Metrics = { inc: sinon.stub() }
"metrics-sharelatex": @Metrics = { inc: sinon.stub() }
"../TrackChanges/TrackChangesManager": @TrackChangesManager = {}
"../../infrastructure/LockManager":@LockManager
'redis-sharelatex':createClient:-> auth:->

View file

@ -15,7 +15,7 @@ describe "EditorHttpController", ->
"./EditorRealTimeController": @EditorRealTimeController = {}
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
"./EditorController": @EditorController = {}
'../../infrastructure/Metrics': @Metrics = {inc: sinon.stub()}
'metrics-sharelatex': @Metrics = {inc: sinon.stub()}
"../Collaborators/CollaboratorsHandler": @CollaboratorsHandler = {}
"../Collaborators/CollaboratorsInviteHandler": @CollaboratorsInviteHandler = {}

View file

@ -37,7 +37,7 @@ describe "EmailSender", ->
log:->
warn:->
err:->
"../../infrastructure/Metrics": inc:->
"metrics-sharelatex": inc:->

View file

@ -65,7 +65,7 @@ describe "ProjectController", ->
"logger-sharelatex":
log:->
err:->
"../../infrastructure/Metrics":
"metrics-sharelatex":
Timer:->
done:->
inc:->

View file

@ -50,7 +50,7 @@ describe 'ProjectCreationHandler', ->
'./ProjectEntityHandler':@ProjectEntityHandler
"settings-sharelatex": @Settings = {}
'logger-sharelatex': {log:->}
"../../infrastructure/Metrics": {
"metrics-sharelatex": {
inc: ()->,
timeAsyncMethod: ()->
}

View file

@ -16,7 +16,7 @@ describe "ProjectGetter", ->
projects: {}
users: {}
ObjectId: ObjectId
"../../infrastructure/Metrics": timeAsyncMethod: sinon.stub()
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
"../../models/Project": Project: @Project = {}
"../Collaborators/CollaboratorsHandler": @CollaboratorsHandler = {}
"logger-sharelatex":

View file

@ -14,7 +14,7 @@ describe 'TpdsController', ->
'logger-sharelatex':
log:->
err:->
"../../infrastructure/Metrics": inc:->
"metrics-sharelatex": inc:->
@user_id = "dsad29jlkjas"

View file

@ -42,7 +42,7 @@ describe 'TpdsUpdateSender', ->
'../../models/Project': Project:@Project
'request':@request
'../Collaborators/CollaboratorsHandler': @CollaboratorsHandler
"../../infrastructure/Metrics":
"metrics-sharelatex":
inc:->
describe "_enqueue", ->

View file

@ -24,7 +24,7 @@ describe 'UpdateMerger :', ->
'logger-sharelatex':
log: ->
err: ->
"../../infrastructure/Metrics":
"metrics-sharelatex":
Timer:->
done:->
@project_id = "project_id_here"

View file

@ -26,7 +26,7 @@ describe "ArchiveManager", ->
@ArchiveManager = SandboxedModule.require modulePath, requires:
"child_process": @child
"logger-sharelatex": @logger
"../../infrastructure/Metrics": @metrics
"metrics-sharelatex": @metrics
"fs": @fs = {}
describe "extractZipArchive", ->

View file

@ -21,7 +21,7 @@ describe "ProjectUploadController", ->
"./ProjectUploadManager" : @ProjectUploadManager = {}
"./FileSystemImportManager" : @FileSystemImportManager = {}
"logger-sharelatex" : @logger = {log: sinon.stub(), error: sinon.stub(), err:->}
"../../infrastructure/Metrics": @metrics
"metrics-sharelatex": @metrics
'../Authentication/AuthenticationController': @AuthenticationController
"fs" : @fs = {}

View file

@ -77,7 +77,7 @@ describe "UserController", ->
"logger-sharelatex":
log:->
err:->
"../../infrastructure/Metrics": inc:->
"metrics-sharelatex": inc:->
@res =
send: sinon.stub()

View file

@ -21,7 +21,7 @@ describe "UserCreator", ->
"../../models/User": User:@UserModel
"./UserLocator":@UserLocator
"logger-sharelatex":{log:->}
'../../infrastructure/Metrics': {timeAsyncMethod: ()->}
'metrics-sharelatex': {timeAsyncMethod: ()->}
@email = "bob.oswald@gmail.com"

View file

@ -10,7 +10,7 @@ describe "UserLocator", ->
@user = {_id:"12390i"}
@UserLocator = SandboxedModule.require modulePath, requires:
"../../infrastructure/mongojs": db: @db = { users: {} }
"../../infrastructure/Metrics": timeAsyncMethod: sinon.stub()
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
@db.users =
findOne : sinon.stub().callsArgWith(1, null, @user)

View file

@ -21,7 +21,7 @@ describe "UserUpdater", ->
"logger-sharelatex": log:->
"./UserLocator":@UserLocator
"../../infrastructure/mongojs":@mongojs
"../../infrastructure/Metrics": timeAsyncMethod: sinon.stub()
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
@stubbedUser =
name:"bob"

View file

@ -13,7 +13,7 @@ describe 'LockManager - getting the lock', ->
createClient : () =>
auth:->
"settings-sharelatex":{redis:{}}
"./Metrics": inc:->
"metrics-sharelatex": inc:->
@callback = sinon.stub()
@doc_id = "doc-id-123"

View file

@ -14,7 +14,7 @@ describe 'LockManager - trying the lock', ->
auth:->
set: @set = sinon.stub()
"settings-sharelatex":{redis:{}}
"./Metrics": inc:->
"metrics-sharelatex": inc:->
@callback = sinon.stub()
@doc_id = "doc-id-123"