[web] Add startup metrics (#25277)
* [web] refactor startup sequence The primary objective here is to call loadGlobalBlobs() only once. But to get there, we need to reorder things and add extra try/catch sections to ensure we are not letting the global uncaughtException handler catch startup errors. Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com> * [web] add metrics for startup steps Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com> --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> GitOrigin-RevId: c73edea02516e919d55b896588dcd1862835fedf
This commit is contained in:
committed by
Copybot
co-authored by
Jakob Ackermann
parent
f0856c862f
commit
9a2847dbee
@@ -4,6 +4,7 @@ const { promisify, callbackify } = require('util')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const Views = require('./Views')
|
||||
const _ = require('lodash')
|
||||
const Metrics = require('@overleaf/metrics')
|
||||
|
||||
const MODULE_BASE_PATH = Path.join(__dirname, '/../../../modules')
|
||||
|
||||
@@ -15,7 +16,11 @@ let _viewIncludes = {}
|
||||
|
||||
async function modules() {
|
||||
if (!_modulesLoaded) {
|
||||
const beforeLoadModules = performance.now()
|
||||
await loadModules()
|
||||
Metrics.gauge('web_startup', performance.now() - beforeLoadModules, 1, {
|
||||
path: 'loadModules',
|
||||
})
|
||||
}
|
||||
return _modules
|
||||
}
|
||||
|
||||
@@ -372,6 +372,10 @@ if (Settings.enabledServices.includes('web')) {
|
||||
metrics.injectMetricsRoute(webRouter)
|
||||
metrics.injectMetricsRoute(privateApiRouter)
|
||||
|
||||
const beforeRouterInitialize = performance.now()
|
||||
await Router.initialize(webRouter, privateApiRouter, publicApiRouter)
|
||||
metrics.gauge('web_startup', performance.now() - beforeRouterInitialize, 1, {
|
||||
path: 'Router.initialize',
|
||||
})
|
||||
|
||||
export default { app, server }
|
||||
|
||||
Reference in New Issue
Block a user