mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 14:49:07 +00:00
Add debug logging for worker initialization and heartbeat checks
This commit is contained in:
parent
af177d0569
commit
21ea8d0aa2
@ -14,11 +14,15 @@ const APP_NAME: string = "worker";
|
||||
|
||||
const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
try {
|
||||
logger.debug("Initializing Worker");
|
||||
|
||||
// Initialize telemetry
|
||||
Telemetry.init({
|
||||
serviceName: APP_NAME,
|
||||
});
|
||||
|
||||
logger.debug("Telemetry initialized");
|
||||
|
||||
const statusCheck: PromiseVoidFunction = async (): Promise<void> => {
|
||||
// Check the status of infrastructure components
|
||||
return await InfrastructureStatus.checkStatus({
|
||||
@ -37,27 +41,43 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
},
|
||||
});
|
||||
|
||||
logger.debug("App initialized");
|
||||
|
||||
// Connect to Postgres database
|
||||
await PostgresAppInstance.connect();
|
||||
|
||||
logger.debug("Postgres connected");
|
||||
|
||||
// Connect to Redis
|
||||
await Redis.connect();
|
||||
|
||||
logger.debug("Redis connected");
|
||||
|
||||
// Connect to Clickhouse database
|
||||
await ClickhouseAppInstance.connect(
|
||||
ClickhouseAppInstance.getDatasourceOptions(),
|
||||
);
|
||||
|
||||
logger.debug("Clickhouse connected");
|
||||
|
||||
// Initialize real-time functionalities
|
||||
await Realtime.init();
|
||||
|
||||
logger.debug("Realtime initialized");
|
||||
|
||||
// Initialize home routes at the end since it has a catch-all route
|
||||
await WorkerRoutes.init();
|
||||
|
||||
logger.debug("Routes initialized");
|
||||
|
||||
// Add default routes to the app
|
||||
await App.addDefaultRoutes();
|
||||
|
||||
logger.debug("Default routes added");
|
||||
|
||||
logger.info("Worker Initialized Successfully");
|
||||
} catch (err) {
|
||||
logger.error("App Init Failed:");
|
||||
logger.error("Worker Init Failed:");
|
||||
logger.error(err);
|
||||
throw err;
|
||||
}
|
||||
|
@ -101,6 +101,10 @@ RunCron(
|
||||
continue;
|
||||
}
|
||||
|
||||
logger.debug(
|
||||
`Updating incoming request monitor heartbeat checked at: ${monitor.id?.toString()}`,
|
||||
);
|
||||
|
||||
await MonitorService.updateOneById({
|
||||
id: monitor.id!,
|
||||
data: {
|
||||
|
@ -15,6 +15,7 @@ RunCron(
|
||||
"ServerMonitor:CheckOnlineStatus",
|
||||
{ schedule: EVERY_MINUTE, runOnStartup: false },
|
||||
async () => {
|
||||
try {
|
||||
const twoMinsAgo: Date = OneUptimeDate.getSomeMinutesAgo(2);
|
||||
|
||||
const serverMonitors: Array<Monitor> = await MonitorService.findBy({
|
||||
@ -64,6 +65,10 @@ RunCron(
|
||||
logger.error(error);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("Error in ServerMonitor:CheckOnlineStatus");
|
||||
logger.error(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user