mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
adfe7abaaf
Reintroduce socket leak detection in all services GitOrigin-RevId: 0a9a1ced0b886dbb267cb46beb5da7d0133d39aa
28 lines
925 B
JavaScript
28 lines
925 B
JavaScript
import metrics from '@overleaf/metrics'
|
|
import Settings from '@overleaf/settings'
|
|
import logger from '@overleaf/logger'
|
|
import express from 'express'
|
|
import bodyParser from 'body-parser'
|
|
import * as SpellingAPIController from './SpellingAPIController.js'
|
|
import * as HealthCheckController from './HealthCheckController.js'
|
|
|
|
metrics.initialize('spelling')
|
|
logger.initialize('spelling')
|
|
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()
|
|
|
|
metrics.injectMetricsRoute(app)
|
|
|
|
app.use(bodyParser.json({ limit: '2mb' }))
|
|
app.use(metrics.http.monitor(logger))
|
|
|
|
app.post('/user/:user_id/check', SpellingAPIController.check)
|
|
app.get('/status', (req, res) => res.send({ status: 'spelling api is up' }))
|
|
|
|
app.get('/health_check', HealthCheckController.healthCheck)
|