mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Remove the Metrics module, use metrics-sharelatex
This commit is contained in:
parent
49de7bf315
commit
043520fc28
50 changed files with 49 additions and 50 deletions
|
@ -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")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
User = require("../../models/User").User
|
||||
logger = require 'logger-sharelatex'
|
||||
metrics = require("../../infrastructure/Metrics")
|
||||
metrics = require("metrics-sharelatex")
|
||||
|
||||
module.exports = BetaProgramHandler =
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Metrics = require "../../infrastructure/Metrics"
|
||||
Metrics = require "metrics-sharelatex"
|
||||
Project = require("../../models/Project").Project
|
||||
CompileManager = require("./CompileManager")
|
||||
ClsiManager = require("./ClsiManager")
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
metrics = require('./Metrics')
|
||||
metrics = require('metrics-sharelatex')
|
||||
module.exports =
|
||||
log: (req)->
|
||||
if req.headers["user-agent"]?
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
module.exports = require("metrics-sharelatex")
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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() }
|
||||
|
|
|
@ -26,7 +26,7 @@ describe 'BetaProgramHandler', ->
|
|||
log: sinon.stub()
|
||||
err: sinon.stub()
|
||||
},
|
||||
"../../infrastructure/Metrics": @logger = {
|
||||
"metrics-sharelatex": @logger = {
|
||||
inc: sinon.stub()
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -32,7 +32,7 @@ describe 'DocumentUpdaterHandler', ->
|
|||
"../../models/Project": Project: @Project={}
|
||||
'../../Features/Project/ProjectLocator':{}
|
||||
'redis-sharelatex' : createClient: () => @rclient
|
||||
"../../infrastructure/Metrics":
|
||||
"metrics-sharelatex":
|
||||
Timer:->
|
||||
done:->
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:->
|
||||
|
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ describe "EmailSender", ->
|
|||
log:->
|
||||
warn:->
|
||||
err:->
|
||||
"../../infrastructure/Metrics": inc:->
|
||||
"metrics-sharelatex": inc:->
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ describe "ProjectController", ->
|
|||
"logger-sharelatex":
|
||||
log:->
|
||||
err:->
|
||||
"../../infrastructure/Metrics":
|
||||
"metrics-sharelatex":
|
||||
Timer:->
|
||||
done:->
|
||||
inc:->
|
||||
|
|
|
@ -50,7 +50,7 @@ describe 'ProjectCreationHandler', ->
|
|||
'./ProjectEntityHandler':@ProjectEntityHandler
|
||||
"settings-sharelatex": @Settings = {}
|
||||
'logger-sharelatex': {log:->}
|
||||
"../../infrastructure/Metrics": {
|
||||
"metrics-sharelatex": {
|
||||
inc: ()->,
|
||||
timeAsyncMethod: ()->
|
||||
}
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -14,7 +14,7 @@ describe 'TpdsController', ->
|
|||
'logger-sharelatex':
|
||||
log:->
|
||||
err:->
|
||||
"../../infrastructure/Metrics": inc:->
|
||||
"metrics-sharelatex": inc:->
|
||||
|
||||
@user_id = "dsad29jlkjas"
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ describe 'TpdsUpdateSender', ->
|
|||
'../../models/Project': Project:@Project
|
||||
'request':@request
|
||||
'../Collaborators/CollaboratorsHandler': @CollaboratorsHandler
|
||||
"../../infrastructure/Metrics":
|
||||
"metrics-sharelatex":
|
||||
inc:->
|
||||
|
||||
describe "_enqueue", ->
|
||||
|
|
|
@ -24,7 +24,7 @@ describe 'UpdateMerger :', ->
|
|||
'logger-sharelatex':
|
||||
log: ->
|
||||
err: ->
|
||||
"../../infrastructure/Metrics":
|
||||
"metrics-sharelatex":
|
||||
Timer:->
|
||||
done:->
|
||||
@project_id = "project_id_here"
|
||||
|
|
|
@ -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", ->
|
||||
|
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ describe "UserController", ->
|
|||
"logger-sharelatex":
|
||||
log:->
|
||||
err:->
|
||||
"../../infrastructure/Metrics": inc:->
|
||||
"metrics-sharelatex": inc:->
|
||||
|
||||
@res =
|
||||
send: sinon.stub()
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue