Merge pull request #13214 from overleaf/bg-add-socket-leak-detection-to-all-services

add socket leak detection to all services

GitOrigin-RevId: 9481222258b796ca8c3b50cdd7ce60c05f0f9f61
This commit is contained in:
Eric Mc Sween 2023-05-29 07:18:39 -04:00 committed by Copybot
parent 1194e9a942
commit c625fef364
9 changed files with 10 additions and 0 deletions

View file

@ -13,6 +13,8 @@ metrics.initialize('chat')
logger.initialize('chat')
metrics.open_sockets.monitor()
metrics.leaked_sockets.monitor(logger)
export async function createServer() {
const app = express()

View file

@ -18,6 +18,7 @@ const Path = require('path')
Metrics.open_sockets.monitor(true)
Metrics.memory.monitor(logger)
Metrics.leaked_sockets.monitor(logger)
const ProjectPersistenceManager = require('./app/js/ProjectPersistenceManager')
const OutputCacheManager = require('./app/js/OutputCacheManager')

View file

@ -23,6 +23,7 @@ logger.initialize('docstore')
if (Metrics.event_loop != null) {
Metrics.event_loop.monitor(logger)
}
Metrics.leaked_sockets.monitor(logger)
Metrics.open_sockets.monitor()
const app = express()

View file

@ -27,6 +27,7 @@ Metrics.memory.monitor(logger)
if (Metrics.event_loop) {
Metrics.event_loop.monitor(logger)
}
Metrics.leaked_sockets.monitor(logger)
app.use(function (req, res, next) {
Metrics.inc('http-request')

View file

@ -29,6 +29,7 @@ logger.initialize('history-v1')
Metrics.open_sockets.monitor()
Metrics.injectMetricsRoute(app)
app.use(Metrics.http.monitor(logger))
Metrics.leaked_sockets.monitor(logger)
// We may have fairly large JSON bodies when receiving large Changes. Clients
// may have to handle 413 status codes and try creating files instead of sending

View file

@ -16,6 +16,7 @@ if (Settings.sentry.dsn) {
Metrics.initialize('project-history')
Metrics.event_loop.monitor(logger)
Metrics.memory.monitor(logger)
Metrics.leaked_sockets.monitor(logger)
Metrics.open_sockets.monitor()
// log updates as truncated strings

View file

@ -6,6 +6,7 @@ const async = require('async')
const logger = require('@overleaf/logger')
logger.initialize('real-time')
Metrics.event_loop.monitor(logger)
Metrics.leaked_sockets.monitor(logger)
Metrics.open_sockets.monitor()
const express = require('express')

View file

@ -12,6 +12,7 @@ if (Settings.sentry?.dsn != null) {
logger.initializeErrorReporting(Settings.sentry.dsn)
}
metrics.memory.monitor(logger)
metrics.leaked_sockets.monitor(logger)
metrics.open_sockets.monitor()
export const app = express()

View file

@ -34,6 +34,7 @@ http.globalAgent.maxSockets = Settings.limits.httpGlobalAgentMaxSockets
https.globalAgent.maxSockets = Settings.limits.httpsGlobalAgentMaxSockets
metrics.memory.monitor(logger)
metrics.leaked_sockets.monitor(logger)
metrics.open_sockets.monitor()
const Server = require('./app/src/infrastructure/Server')