Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(health): logs error messages #451

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/health/logic/healthLogic.js
Original file line number Diff line number Diff line change
@@ -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 = {
/**
Expand All @@ -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;
}
},
Expand All @@ -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;
}
},
Expand All @@ -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;
}
},
Expand All @@ -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;
}
},
Expand Down