feat: add logging for health check results and PostgreSQL connection status
This commit is contained in:
@@ -23,6 +23,8 @@ app.get('/health', async (req, res) => {
|
||||
|
||||
const allOk = Object.values(postgres).every(s => s === 'connected') && influx && minio;
|
||||
|
||||
console.log("Health check results:", { postgres, influx: influx ? 'connected' : 'disconnected', minio: minio ? 'connected' : 'disconnected' });
|
||||
|
||||
res.json({
|
||||
status: allOk ? "ok" : "degraded",
|
||||
service: "api",
|
||||
|
||||
@@ -78,6 +78,7 @@ async function checkPostgres() {
|
||||
for (const [name, pool] of Object.entries(pools)) {
|
||||
try {
|
||||
await pool.query('SELECT NOW()');
|
||||
console.log(`PostgreSQL connection check successful for ${name}`);
|
||||
status[name] = 'connected';
|
||||
} catch (error) {
|
||||
console.log(`PostgreSQL connection check failed for ${name}:`, error.message);
|
||||
|
||||
Reference in New Issue
Block a user