mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #17268 from overleaf/dp-remove-old-mongo-metrics
Remove timeAsyncMethod mongo metrics GitOrigin-RevId: 1ba3a1fd51b9d0766355c31791ae9836d832afe8
This commit is contained in:
@@ -22,7 +22,6 @@ describe('MongoManager', function () {
|
||||
db: this.db,
|
||||
ObjectId,
|
||||
},
|
||||
'@overleaf/metrics': { timeAsyncMethod: sinon.stub() },
|
||||
'@overleaf/settings': {
|
||||
max_deleted_docs: 42,
|
||||
docstore: { archivingLockDurationMs: 5000 },
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
let Notifications
|
||||
const logger = require('@overleaf/logger')
|
||||
const { db, ObjectId } = require('./mongodb')
|
||||
const metrics = require('@overleaf/metrics')
|
||||
|
||||
module.exports = Notifications = {
|
||||
module.exports = {
|
||||
getUserNotifications(userId, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
@@ -132,6 +130,3 @@ module.exports = Notifications = {
|
||||
db.notifications.deleteOne(searchOps, callback)
|
||||
},
|
||||
}
|
||||
;['getUserNotifications', 'addNotification'].map(method =>
|
||||
metrics.timeAsyncMethod(Notifications, method, 'mongo.Notifications', logger)
|
||||
)
|
||||
|
||||
@@ -41,7 +41,6 @@ describe('Notifications Tests', function () {
|
||||
requires: {
|
||||
'@overleaf/settings': {},
|
||||
'./mongodb': { db: this.db, ObjectId },
|
||||
'@overleaf/metrics': { timeAsyncMethod: sinon.stub() },
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const { callbackify } = require('util')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const logger = require('@overleaf/logger')
|
||||
const metrics = require('@overleaf/metrics')
|
||||
const settings = require('@overleaf/settings')
|
||||
const request = require('requestretry')
|
||||
const { promisifyAll } = require('@overleaf/promise-utils')
|
||||
@@ -373,18 +372,6 @@ function makeAffiliationRequest(options, callback) {
|
||||
callback(null, body)
|
||||
})
|
||||
}
|
||||
;[
|
||||
'getInstitutionAffiliations',
|
||||
'getConfirmedInstitutionAffiliations',
|
||||
'getUserAffiliations',
|
||||
].map(method =>
|
||||
metrics.timeAsyncMethod(
|
||||
InstitutionsAPI,
|
||||
method,
|
||||
'mongo.InstitutionsAPI',
|
||||
logger
|
||||
)
|
||||
)
|
||||
|
||||
InstitutionsAPI.promises = promisifyAll(InstitutionsAPI, {
|
||||
without: [
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const logger = require('@overleaf/logger')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const metrics = require('@overleaf/metrics')
|
||||
const Settings = require('@overleaf/settings')
|
||||
@@ -242,10 +241,3 @@ module.exports = {
|
||||
createExampleProject,
|
||||
},
|
||||
}
|
||||
|
||||
metrics.timeAsyncMethod(
|
||||
module.exports,
|
||||
'createBlankProject',
|
||||
'mongo.ProjectCreationHandler',
|
||||
logger
|
||||
)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
const { db } = require('../../infrastructure/mongodb')
|
||||
const logger = require('@overleaf/logger')
|
||||
const metrics = require('@overleaf/metrics')
|
||||
const { promisify } = require('util')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const Settings = require('@overleaf/settings')
|
||||
@@ -94,11 +92,3 @@ const promises = {
|
||||
LearnedWordsManager.promises = promises
|
||||
|
||||
module.exports = LearnedWordsManager
|
||||
;['learnWord', 'unlearnWord', 'getLearnedWords'].map(method =>
|
||||
metrics.timeAsyncMethod(
|
||||
LearnedWordsManager,
|
||||
method,
|
||||
'mongo.LearnedWordsManager',
|
||||
logger
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
const { callbackify } = require('util')
|
||||
const { db } = require('../../infrastructure/mongodb')
|
||||
const metrics = require('@overleaf/metrics')
|
||||
const logger = require('@overleaf/logger')
|
||||
const moment = require('moment')
|
||||
const settings = require('@overleaf/settings')
|
||||
const { promisifyAll } = require('@overleaf/promise-utils')
|
||||
@@ -305,16 +303,6 @@ const decorateFullEmails = (
|
||||
|
||||
return emailsData
|
||||
}
|
||||
;[
|
||||
'getUser',
|
||||
'getUserEmail',
|
||||
'getUserByMainEmail',
|
||||
'getUserByAnyEmail',
|
||||
'getUsers',
|
||||
'ensureUniqueEmailAddress',
|
||||
].map(method =>
|
||||
metrics.timeAsyncMethod(UserGetter, method, 'mongo.UserGetter', logger)
|
||||
)
|
||||
|
||||
UserGetter.promises = promisifyAll(UserGetter, {
|
||||
without: ['getSsoUsersAtInstitution', 'getUserFullEmails'],
|
||||
|
||||
@@ -20,9 +20,6 @@ describe('InstitutionsAPI', function () {
|
||||
}
|
||||
this.InstitutionsAPI = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'@overleaf/metrics': {
|
||||
timeAsyncMethod: sinon.stub(),
|
||||
},
|
||||
'@overleaf/settings': this.settings,
|
||||
requestretry: this.request,
|
||||
'@overleaf/fetch-utils': {
|
||||
|
||||
@@ -53,9 +53,6 @@ describe('ProjectGetter', function () {
|
||||
this.ProjectGetter = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'../../infrastructure/mongodb': { db: this.db, ObjectId },
|
||||
'@overleaf/metrics': {
|
||||
timeAsyncMethod: sinon.stub(),
|
||||
},
|
||||
'../../models/Project': {
|
||||
Project: this.Project,
|
||||
},
|
||||
|
||||
@@ -21,7 +21,6 @@ describe('LearnedWordsManager', function () {
|
||||
requires: {
|
||||
'../../infrastructure/mongodb': { db: this.db },
|
||||
'@overleaf/metrics': {
|
||||
timeAsyncMethod: sinon.stub(),
|
||||
inc: sinon.stub(),
|
||||
},
|
||||
'@overleaf/settings': {
|
||||
|
||||
@@ -19,7 +19,6 @@ describe('UserCreator', function () {
|
||||
'../../models/User': {
|
||||
User: this.UserModel,
|
||||
},
|
||||
'@overleaf/metrics': { timeAsyncMethod() {} },
|
||||
'../../infrastructure/Features': (this.Features = {
|
||||
hasFeature: sinon.stub().returns(false),
|
||||
}),
|
||||
|
||||
@@ -49,9 +49,6 @@ describe('UserGetter', function () {
|
||||
requires: {
|
||||
'../Helpers/Mongo': { normalizeQuery, normalizeMultiQuery },
|
||||
'../../infrastructure/mongodb': this.Mongo,
|
||||
'@overleaf/metrics': {
|
||||
timeAsyncMethod: sinon.stub(),
|
||||
},
|
||||
'@overleaf/settings': (this.settings = {
|
||||
reconfirmNotificationDays: 14,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user