From 972e6cb98fba6ef482241b07e41ed3e81048e292 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 20 Nov 2024 21:33:32 +0000 Subject: [PATCH] Add logging for infrastructure status checks in Status.ts --- Common/Server/Infrastructure/Status.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Common/Server/Infrastructure/Status.ts b/Common/Server/Infrastructure/Status.ts index 6127f5bcf7..826f80142a 100644 --- a/Common/Server/Infrastructure/Status.ts +++ b/Common/Server/Infrastructure/Status.ts @@ -1,4 +1,5 @@ // This class checks the status of all the datasources. +import logger from "../Utils/Logger"; import { ClickhouseAppInstance } from "./ClickhouseDatabase"; import PostgresAppInstance from "./PostgresDatabase"; import Redis from "./Redis"; @@ -10,22 +11,33 @@ export default class InfrastructureStatus { checkPostgresStatus: boolean; checkClickhouseStatus: boolean; }): Promise { + logger.debug("Checking infrastructure status"); + if (data.checkRedisStatus) { + logger.debug("Checking Redis status"); if (!(await Redis.checkConnnectionStatus())) { + logger.debug("Redis is not connected"); throw new DatabaseNotConnectedException("Redis is not connected"); } + logger.debug("Redis is connected"); } if (data.checkPostgresStatus) { + logger.debug("Checking Postgres status"); if (!(await PostgresAppInstance.checkConnnectionStatus())) { + logger.debug("Postgres is not connected"); throw new DatabaseNotConnectedException("Postgres is not connected"); } + logger.debug("Postgres is connected"); } if (data.checkClickhouseStatus) { + logger.debug("Checking Clickhouse status"); if (!(await ClickhouseAppInstance.checkConnnectionStatus())) { + logger.debug("Clickhouse is not connected"); throw new DatabaseNotConnectedException("Clickhouse is not connected"); } + logger.debug("Clickhouse is connected"); } } }