feat: add logging for health check results and PostgreSQL connection status

This commit is contained in:
Giuseppe Raffa
2026-04-14 12:33:35 +02:00
parent e003770187
commit 063fccfaea
2 changed files with 3 additions and 0 deletions

View File

@@ -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",

View File

@@ -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);