mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- Integrated profiling initialization in Probe, Telemetry, TestServer, and Worker services. - Added environment variables for enabling profiling in various services. - Created Profiling utility to handle CPU profiling and send data to OTLP endpoint. - Introduced new metric types for exceptions, spans, and dashboards. - Developed utility classes for handling alert and incident metrics. - Added new React components for displaying alert and incident metrics in the dashboard.
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import MainAPI from "./API/Main";
|
|
import SettingsAPI from "./API/Settings";
|
|
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
|
import Express, { ExpressApplication } from "Common/Server/Utils/Express";
|
|
import logger from "Common/Server/Utils/Logger";
|
|
import App from "Common/Server/Utils/StartServer";
|
|
import Telemetry from "Common/Server/Utils/Telemetry";
|
|
import Profiling from "Common/Server/Utils/Profiling";
|
|
import "ejs";
|
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
const APP_NAME: string = "test-server";
|
|
|
|
app.use([`/${APP_NAME}`, "/"], MainAPI);
|
|
app.use([`/${APP_NAME}`, "/"], SettingsAPI);
|
|
|
|
const init: PromiseVoidFunction = async (): Promise<void> => {
|
|
try {
|
|
// Initialize telemetry
|
|
Telemetry.init({
|
|
serviceName: APP_NAME,
|
|
});
|
|
|
|
// Initialize profiling (opt-in via ENABLE_PROFILING env var)
|
|
Profiling.init({
|
|
serviceName: APP_NAME,
|
|
});
|
|
|
|
// init the app
|
|
await App.init({
|
|
appName: APP_NAME,
|
|
port: undefined,
|
|
isFrontendApp: false,
|
|
statusOptions: {
|
|
liveCheck: async () => {},
|
|
readyCheck: async () => {},
|
|
},
|
|
});
|
|
|
|
// add default routes
|
|
await App.addDefaultRoutes();
|
|
} catch (err) {
|
|
logger.error("App Init Failed:");
|
|
logger.error(err);
|
|
throw err;
|
|
}
|
|
};
|
|
|
|
init().catch((err: Error) => {
|
|
logger.error(err);
|
|
logger.error("Exiting node process");
|
|
process.exit(1);
|
|
});
|