mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #13255 from overleaf/em-socket-leak-detection
Reintroduce socket leak detection in all services GitOrigin-RevId: 0a9a1ced0b886dbb267cb46beb5da7d0133d39aa
This commit is contained in:
parent
aeadafa61b
commit
adfe7abaaf
9 changed files with 12 additions and 1 deletions
|
@ -84,7 +84,9 @@ const REDACT_REGEX = /^(Authorization|Set-Cookie|Cookie):.*?\r/gim
|
|||
function redactObject(obj) {
|
||||
const result = {}
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (key === 'headers') {
|
||||
if (value == null) {
|
||||
result[key] = null
|
||||
} else if (key === 'headers') {
|
||||
// remove headers with sensitive information
|
||||
result[key] = flattenHeaders(value).replace(
|
||||
REDACT_REGEX,
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue