feat: enhance InfluxDB health check logging with detailed error information

This commit is contained in:
Giuseppe Raffa
2026-04-14 12:54:25 +02:00
parent e13bbe3d02
commit 3032dbcc96

View File

@@ -62,10 +62,18 @@ async function query(bucket, relativeTime, measurement, sensor, field) {
async function checkInflux() {
try {
await querying.rows(`from(bucket: "boat") |> range(start: -1s) |> limit(n:1)`).next();
return true;
const result = await querying.collectRows(
`from(bucket: "boat") |> range(start: -1s) |> limit(n:1)`
);
console.log('InfluxDB: OK');
return { ok: true };
} catch (error) {
return false;
console.error('InfluxDB check failed:', {
message: error.message,
statusCode: error.statusCode ?? 'N/A',
body: error.body ?? 'N/A'
});
return false
}
}