From 2cf080df25c3fc84c0cd52200157e94637eedc15 Mon Sep 17 00:00:00 2001 From: Keno Dressel Date: Mon, 19 Aug 2024 13:38:49 +0200 Subject: [PATCH] fix(health): logs error messages --- modules/health/logic/healthLogic.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/health/logic/healthLogic.js b/modules/health/logic/healthLogic.js index c4aea1c4..9cd3035f 100644 --- a/modules/health/logic/healthLogic.js +++ b/modules/health/logic/healthLogic.js @@ -1,7 +1,9 @@ +const Sentry = require('@sentry/node'); const ipfs = require('../../backup/logic/ipfsLogic'); const cache = require('../../cache/utils/cache'); const models = require('../../../models'); const aeternity = require('../../aeternity/logic/aeternity'); +const logger = require('../../../utils/logger')(module); const HealthLogic = { /** @@ -17,6 +19,8 @@ const HealthLogic = { .map(async key => models[key].findOne({ raw: true }))); return true; } catch (e) { + logger.error(`DB health failed with: ${e.message}`); + Sentry.captureException(e); return false; } }, @@ -26,6 +30,8 @@ const HealthLogic = { await ipfs.getCoreVitals(); return true; } catch (e) { + logger.error(`IPFS health failed with: ${e.message}`); + Sentry.captureException(e); return false; } }, @@ -35,6 +41,8 @@ const HealthLogic = { await cache.getOrSet(['redisTest'], async () => 'done'); return true; } catch (e) { + logger.error(`Redis health failed with: ${e.message}`); + Sentry.captureException(e); return false; } }, @@ -44,6 +52,8 @@ const HealthLogic = { const balance = await aeternity.getBalance(); return parseInt(balance, 10) > 0; } catch (e) { + logger.error(`AE health failed with: ${e.message}`); + Sentry.captureException(e); return false; } },