Merge pull request #3331 from overleaf/csh-issue-3661-bump-agents

Update metrics module

GitOrigin-RevId: bdef141035f277ce4863f14f8a6e166d710b1111
This commit is contained in:
Christopher Hoskin 2020-10-30 08:10:50 +00:00 committed by Copybot
parent 46be87f7c5
commit 1e8598a8d9
62 changed files with 472 additions and 645 deletions

View file

@ -9,7 +9,7 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
metrics.initialize(process.env['METRICS_APP_NAME'] || 'web')
const Settings = require('settings-sharelatex')
const logger = require('logger-sharelatex')

View file

@ -2,7 +2,7 @@ const AuthenticationManager = require('./AuthenticationManager')
const OError = require('@overleaf/o-error')
const LoginRateLimiter = require('../Security/LoginRateLimiter')
const UserUpdater = require('../User/UserUpdater')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const logger = require('logger-sharelatex')
const querystring = require('querystring')
const Settings = require('settings-sharelatex')

View file

@ -1,5 +1,5 @@
const { callbackify } = require('util')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const UserUpdater = require('../User/UserUpdater')
async function optIn(userId) {

View file

@ -19,7 +19,7 @@ const ClsiStateManager = require('./ClsiStateManager')
const _ = require('underscore')
const ClsiFormatChecker = require('./ClsiFormatChecker')
const DocumentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const Errors = require('../Errors/Errors')
const VALID_COMPILERS = ['pdflatex', 'latex', 'xelatex', 'lualatex']

View file

@ -15,7 +15,7 @@
*/
let CompileController
const OError = require('@overleaf/o-error')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const ProjectGetter = require('../Project/ProjectGetter')
const CompileManager = require('./CompileManager')
const ClsiManager = require('./ClsiManager')

View file

@ -21,7 +21,7 @@ const ProjectGetter = require('../Project/ProjectGetter')
const ProjectRootDocManager = require('../Project/ProjectRootDocManager')
const UserGetter = require('../User/UserGetter')
const ClsiManager = require('./ClsiManager')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const rateLimiter = require('../../infrastructure/RateLimiter')
module.exports = CompileManager = {

View file

@ -4,7 +4,7 @@ const settings = require('settings-sharelatex')
const _ = require('underscore')
const async = require('async')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const { promisify } = require('util')
module.exports = {

View file

@ -13,7 +13,7 @@
*/
let ProjectDownloadsController
const logger = require('logger-sharelatex')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const ProjectGetter = require('../Project/ProjectGetter')
const ProjectZipStreamManager = require('./ProjectZipStreamManager')
const DocumentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')

View file

@ -15,7 +15,7 @@
*/
const logger = require('logger-sharelatex')
const OError = require('@overleaf/o-error')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const sanitize = require('sanitizer')
const ProjectEntityUpdateHandler = require('../Project/ProjectEntityUpdateHandler')
const ProjectOptionsHandler = require('../Project/ProjectOptionsHandler')

View file

@ -3,7 +3,7 @@ const EditorController = require('./EditorController')
const ProjectGetter = require('../Project/ProjectGetter')
const AuthorizationManager = require('../Authorization/AuthorizationManager')
const ProjectEditorHandler = require('../Project/ProjectEditorHandler')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const CollaboratorsGetter = require('../Collaborators/CollaboratorsGetter')
const CollaboratorsInviteHandler = require('../Collaborators/CollaboratorsInviteHandler')
const CollaboratorsHandler = require('../Collaborators/CollaboratorsHandler')

View file

@ -13,7 +13,7 @@
*/
let EditorRealTimeController
const Settings = require('settings-sharelatex')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const RedisWrapper = require('../../infrastructure/RedisWrapper')
const rclient = RedisWrapper.client('pubsub')
const os = require('os')

View file

@ -1,6 +1,6 @@
const { callbackify } = require('util')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const Settings = require('settings-sharelatex')
const nodemailer = require('nodemailer')
const sesTransport = require('nodemailer-ses-transport')

View file

@ -1,5 +1,5 @@
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const settings = require('settings-sharelatex')
const request = require('request')
const { promisifyAll } = require('../../util/promises')

View file

@ -10,7 +10,7 @@ const ProjectDuplicator = require('./ProjectDuplicator')
const ProjectCreationHandler = require('./ProjectCreationHandler')
const EditorController = require('../Editor/EditorController')
const ProjectHelper = require('./ProjectHelper')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const { User } = require('../../models/User')
const TagsHandler = require('../Tags/TagsHandler')
const SubscriptionLocator = require('../Subscription/SubscriptionLocator')

View file

@ -15,7 +15,7 @@
const logger = require('logger-sharelatex')
const OError = require('@overleaf/o-error')
const async = require('async')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const Settings = require('settings-sharelatex')
const { ObjectId } = require('mongodb')
const { Project } = require('../../models/Project')

View file

@ -16,7 +16,7 @@
const { db } = require('../../infrastructure/mongodb')
const { normalizeQuery } = require('../Helpers/Mongo')
const OError = require('@overleaf/o-error')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const async = require('async')
const { promisifyAll } = require('../../util/promises')
const { Project } = require('../../models/Project')

View file

@ -15,7 +15,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const logger = require('logger-sharelatex')
const _ = require('underscore')
const DocumentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler')

View file

@ -17,7 +17,7 @@ const tpdsUpdateHandler = require('./TpdsUpdateHandler')
const UpdateMerger = require('./UpdateMerger')
const logger = require('logger-sharelatex')
const Path = require('path')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const NotificationsBuilder = require('../Notifications/NotificationsBuilder')
const AuthenticationController = require('../Authentication/AuthenticationController')
const TpdsQueueManager = require('./TpdsQueueManager').promises

View file

@ -2,7 +2,7 @@ const { ObjectId } = require('mongodb')
const _ = require('lodash')
const { callbackify } = require('util')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const path = require('path')
const request = require('request-promise-native')
const settings = require('settings-sharelatex')

View file

@ -14,7 +14,7 @@
*/
const logger = require('logger-sharelatex')
const OError = require('@overleaf/o-error')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const fs = require('fs')
const Path = require('path')
const fse = require('fs-extra')

View file

@ -13,7 +13,7 @@
*/
let ProjectUploadController
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const fs = require('fs')
const Path = require('path')
const FileSystemImportManager = require('./FileSystemImportManager')

View file

@ -5,7 +5,7 @@ const { User } = require('../../models/User')
const NewsletterManager = require('../Newsletter/NewsletterManager')
const UserRegistrationHandler = require('./UserRegistrationHandler')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const AuthenticationManager = require('../Authentication/AuthenticationManager')
const AuthenticationController = require('../Authentication/AuthenticationController')
const Features = require('../../infrastructure/Features')

View file

@ -1,5 +1,5 @@
const { db } = require('../../infrastructure/mongodb')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const logger = require('logger-sharelatex')
const { promisifyAll } = require('../../util/promises')
const { getUserAffiliations } = require('../Institutions/InstitutionsAPI')

View file

@ -2,7 +2,7 @@ const logger = require('logger-sharelatex')
const OError = require('@overleaf/o-error')
const { db } = require('../../infrastructure/mongodb')
const { normalizeQuery } = require('../Helpers/Mongo')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const async = require('async')
const { callbackify, promisify } = require('util')
const UserGetter = require('./UserGetter')

View file

@ -1,5 +1,5 @@
const { callbackify, promisify } = require('util')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const RedisWrapper = require('./RedisWrapper')
const rclient = RedisWrapper.client('lock')
const logger = require('logger-sharelatex')

View file

@ -10,7 +10,7 @@
*/
let trackOpenSockets
const _ = require('underscore')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
;(trackOpenSockets = function() {
metrics.gauge(
'http.open-sockets',

View file

@ -1,5 +1,5 @@
const settings = require('settings-sharelatex')
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const RedisWrapper = require('./RedisWrapper')
const rclient = RedisWrapper.client('ratelimiter')
const RollingRateLimiter = require('rolling-rate-limiter')

View file

@ -2,7 +2,7 @@ const Path = require('path')
const express = require('express')
const Settings = require('settings-sharelatex')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const expressLocals = require('./ExpressLocals')
const Validation = require('./Validation')
const Router = require('../router')

View file

@ -1,4 +1,4 @@
const Metrics = require('metrics-sharelatex')
const Metrics = require('@overleaf/metrics')
const logger = require('logger-sharelatex')
function computeValidationToken(req) {

View file

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

View file

@ -17,7 +17,7 @@ const Settings = require('settings-sharelatex')
const Path = require('path')
const Url = require('url')
const logger = require('logger-sharelatex')
const metrics = require('metrics-sharelatex')
const metrics = require('@overleaf/metrics')
const UserRegistrationHandler = require('../../../../app/src/Features/User/UserRegistrationHandler')
const EmailHandler = require('../../../../app/src/Features/Email/EmailHandler')
const _ = require('underscore')

View file

@ -42,7 +42,7 @@ describe('LaunchpadController', function() {
err() {},
error() {}
}),
'metrics-sharelatex': (this.Metrics = {}),
'@overleaf/metrics': (this.Metrics = {}),
'../../../../app/src/Features/User/UserRegistrationHandler': (this.UserRegistrationHandler = {}),
'../../../../app/src/Features/Email/EmailHandler': (this.EmailHandler = {}),
'../../../../app/src/Features/User/UserGetter': (this.UserGetter = {}),

File diff suppressed because it is too large Load diff

View file

@ -41,6 +41,7 @@
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.9.4",
"@overleaf/metrics": "^3.3.0",
"@overleaf/o-error": "^3.0.0",
"@pollyjs/adapter-node-http": "^4.2.1",
"@pollyjs/core": "^4.2.1",
@ -92,7 +93,6 @@
"mailchimp-api-v3": "^1.12.0",
"marked": "^0.3.5",
"method-override": "^2.3.3",
"metrics-sharelatex": "^2.6.2",
"minimist": "1.2.5",
"mmmagic": "^0.5.2",
"mocha": "^6.2.2",

View file

@ -33,7 +33,7 @@ describe('AuthenticationController', function() {
'../User/UserUpdater': (this.UserUpdater = {
updateUser: sinon.stub()
}),
'metrics-sharelatex': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'../Security/LoginRateLimiter': (this.LoginRateLimiter = {
processLoginRequest: sinon.stub(),
recordSuccessfulLogin: sinon.stub()

View file

@ -22,7 +22,7 @@ describe('BetaProgramHandler', function() {
console: console
},
requires: {
'metrics-sharelatex': (this.logger = {
'@overleaf/metrics': (this.logger = {
inc: sinon.stub()
}),
'../User/UserUpdater': (this.UserUpdater = {

View file

@ -70,7 +70,7 @@ describe('ClsiManager', function() {
'logger-sharelatex': this.logger,
request: this.request,
'./ClsiFormatChecker': this.ClsiFormatChecker,
'metrics-sharelatex': this.Metrics
'@overleaf/metrics': this.Metrics
}
})
this.project_id = 'project-id'

View file

@ -72,7 +72,7 @@ describe('CompileController', function() {
log: sinon.stub(),
error: sinon.stub()
}),
'metrics-sharelatex': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'./CompileManager': this.CompileManager,
'../User/UserGetter': this.UserGetter,
'./ClsiManager': this.ClsiManager,

View file

@ -45,7 +45,7 @@ describe('CompileManager', function() {
'../User/UserGetter': (this.UserGetter = {}),
'./ClsiManager': (this.ClsiManager = {}),
'../../infrastructure/RateLimiter': this.ratelimiter,
'metrics-sharelatex': (this.Metrics = {
'@overleaf/metrics': (this.Metrics = {
Timer: (Timer = (function() {
Timer = class Timer {
static initClass() {

View file

@ -48,7 +48,7 @@ describe('DocumentUpdaterHandler', function() {
Project: (this.Project = {})
},
'../../Features/Project/ProjectLocator': {},
'metrics-sharelatex': {
'@overleaf/metrics': {
Timer: class {
done() {}
}

View file

@ -36,7 +36,7 @@ describe('ProjectDownloadsController', function() {
requires: {
'./ProjectZipStreamManager': (this.ProjectZipStreamManager = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'metrics-sharelatex': (this.metrics = {}),
'@overleaf/metrics': (this.metrics = {}),
'logger-sharelatex': (this.logger = { log: sinon.stub() }),
'../DocumentUpdater/DocumentUpdaterHandler': this
.DocumentUpdaterHandler

View file

@ -68,7 +68,7 @@ describe('EditorController', function() {
'./EditorRealTimeController': (this.EditorRealTimeController = {
emitToRoom: sinon.stub()
}),
'metrics-sharelatex': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
err: sinon.stub()

View file

@ -138,7 +138,7 @@ describe('EditorHttpController', function() {
'../Project/ProjectEditorHandler': this.ProjectEditorHandler,
'logger-sharelatex': this.logger,
'./EditorController': this.EditorController,
'metrics-sharelatex': this.Metrics,
'@overleaf/metrics': this.Metrics,
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,
'../Collaborators/CollaboratorsHandler': this.CollaboratorsHandler,
'../Collaborators/CollaboratorsInviteHandler': this

View file

@ -34,7 +34,7 @@ describe('EditorRealTimeController', function() {
io: (this.io = {})
},
'settings-sharelatex': { redis: {} },
'metrics-sharelatex': this.Metrics,
'@overleaf/metrics': this.Metrics,
crypto: (this.crypto = {
randomBytes: sinon
.stub()

View file

@ -46,7 +46,7 @@ describe('EmailSender', function() {
warn() {},
err() {}
},
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {}
}
}

View file

@ -37,7 +37,7 @@ describe('InstitutionsAPI', function() {
},
requires: {
'logger-sharelatex': this.logger,
'metrics-sharelatex': {
'@overleaf/metrics': {
timeAsyncMethod: sinon.stub()
},
'settings-sharelatex': this.settings,

View file

@ -143,7 +143,7 @@ describe('ProjectController', function() {
log() {},
err() {}
},
'metrics-sharelatex': this.Metrics,
'@overleaf/metrics': this.Metrics,
'./ProjectDeleter': this.ProjectDeleter,
'./ProjectDuplicator': this.ProjectDuplicator,
'./ProjectCreationHandler': this.ProjectCreationHandler,

View file

@ -77,7 +77,7 @@ describe('ProjectCreationHandler', function() {
'settings-sharelatex': this.Settings,
'../Analytics/AnalyticsManager': this.AnalyticsManager,
'logger-sharelatex': { log() {} },
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {},
timeAsyncMethod() {}
}

View file

@ -40,7 +40,7 @@ describe('ProjectGetter', function() {
}),
ObjectId
},
'metrics-sharelatex': {
'@overleaf/metrics': {
timeAsyncMethod: sinon.stub()
},
'../../models/Project': {

View file

@ -11,7 +11,7 @@ describe('SessionStoreManager', function() {
console: console
},
requires: {
'metrics-sharelatex': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'logger-sharelatex': (this.logger = {
log: sinon.stub(),
warn: sinon.stub(),

View file

@ -48,7 +48,7 @@ describe('TpdsController', function() {
info() {},
err() {}
},
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {}
}
}

View file

@ -70,7 +70,7 @@ describe('TpdsUpdateSender', function() {
'request-promise-native': this.request,
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,
'../User/UserGetter.js': this.UserGetter,
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {}
}
}

View file

@ -54,7 +54,7 @@ describe('ArchiveManager', function() {
open: sinon.stub().callsArgWith(2, null, this.zipfile)
}),
'logger-sharelatex': this.logger,
'metrics-sharelatex': this.metrics,
'@overleaf/metrics': this.metrics,
fs: (this.fs = {}),
'fs-extra': (this.fse = {}),
'./ArchiveErrors': ArchiveErrors

View file

@ -55,7 +55,7 @@ describe('ProjectUploadController', function() {
error: sinon.stub(),
err() {}
}),
'metrics-sharelatex': this.metrics,
'@overleaf/metrics': this.metrics,
'../Authentication/AuthenticationController': this
.AuthenticationController,
'./ArchiveErrors': ArchiveErrors,

View file

@ -120,7 +120,7 @@ describe('UserController', function() {
err() {},
error: sinon.stub()
}),
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {}
},
'../Errors/Errors': Errors,

View file

@ -26,7 +26,7 @@ describe('UserCreator', function() {
'logger-sharelatex': (this.Logger = {
error: sinon.stub()
}),
'metrics-sharelatex': { timeAsyncMethod() {} },
'@overleaf/metrics': { timeAsyncMethod() {} },
'../../infrastructure/Features': (this.Features = {
hasFeature: sinon.stub().returns(false)
}),

View file

@ -54,7 +54,7 @@ describe('UserGetter', function() {
log() {}
},
'../../infrastructure/mongodb': this.Mongo,
'metrics-sharelatex': {
'@overleaf/metrics': {
timeAsyncMethod: sinon.stub()
},
'settings-sharelatex': settings,

View file

@ -53,7 +53,7 @@ describe('UserUpdater', function() {
'../Helpers/Mongo': { normalizeQuery },
'logger-sharelatex': this.logger,
'../../infrastructure/mongodb': this.mongodb,
'metrics-sharelatex': {
'@overleaf/metrics': {
timeAsyncMethod: sinon.stub()
},
'./UserGetter': this.UserGetter,

View file

@ -26,7 +26,7 @@ describe('LockManager - releasing the lock', function() {
'logger-sharelatex': {
log() {}
},
'metrics-sharelatex': {},
'@overleaf/metrics': {},
'./RedisWrapper': {
client() {
return {

View file

@ -48,7 +48,7 @@ describe('LockManager - getting the lock', function() {
slowExecutionThreshold: 5000
}
},
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {},
gauge() {}
}

View file

@ -48,7 +48,7 @@ describe('LockManager - trying the lock', function() {
slowExecutionThreshold: 5000
}
},
'metrics-sharelatex': {
'@overleaf/metrics': {
inc() {}
}
}

View file

@ -50,7 +50,7 @@ describe('RateLimiter', function() {
log: sinon.stub(),
err: sinon.stub()
}),
'metrics-sharelatex': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'./RedisWrapper': this.RedisWrapper
}