Skip to content

Commit

Permalink
take a less havoc wreaking option of logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AniaMakes committed Oct 14, 2021
1 parent 4d21b08 commit c4a6860
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/health-checks.js
Expand Up @@ -7,6 +7,7 @@
const errorRateCheck = require('./error-rate-check');
const unRegisteredServicesHealthCheck = require('./unregistered-services-healthCheck');
const metricsHealthCheck = require('./metrics-healthcheck');
const nLogger = require('@financial-times/n-logger').default;

/**
* @param {ExpressApp} app
Expand Down Expand Up @@ -34,7 +35,14 @@ module.exports = (app, options, meta) => {
res.set({ 'Cache-Control': 'private, no-cache, max-age=0' });
const checks = healthChecks.map((check) => check.getStatus());

checks.forEach(check => {if(!check.id){check.severity = 2, check.ok = false, check.panicGuide = 'Your check needs an ID, per the Health check Standard: https://docs.google.com/document/d/18hefJjImF5IFp9WvPAm9Iq5_GmWzI9ahlKSzShpQl1s/edit?usp=sharing otherwise it is of limited use. ID is an identifier for this check, unique for the given check System Code, or overall System Code. Must only consist of lowercase alphanumeric characters and hyphens.'}})
checks.forEach(check => {if(!check.id){
nLogger.warn({
event: 'HEALTHCHECK_IS_MISSING_ID',
systemName: options.healthChecksAppName || defaultAppName,
systemCode: options.systemCode,
checkName: check.name
});
}})

if (req.params[0]) {
checks.forEach((check) => {
Expand Down

0 comments on commit c4a6860

Please sign in to comment.