Skip to content

Commit

Permalink
housekeeping on logs and healthchecks (#316)
Browse files Browse the repository at this point in the history
Co-authored-by: AniaMakes <[email protected]>
  • Loading branch information
AniaMakes and AniaMakes authored Jul 20, 2021
1 parent 7791265 commit 603d9e7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/pg/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { Logger } = require('../../server/lib/logger');
const massive = require('massive');
const pgConn = require('pg-connection-string');

const { DB } = require('config');
const { DB, NODE_ENV } = require('config');

const MODULE_ID = path.relative(process.cwd(), module.id) || require(path.resolve('./package.json')).name;
const log = new Logger({source: MODULE_ID});
Expand All @@ -16,7 +16,7 @@ let db;

module.exports = exports = async (options = DB) => {
if (!db || options !== DB) {
log.info(`${MODULE_ID} creating new DB instance with options => `, options);
log.info(`${MODULE_ID} (node_env: ${NODE_ENV}) creating new DB instance with options => `, options);

if (options.uri) {
const conn = Object.assign({ ssl: { rejectUnauthorized : false } }, pgConn.parse(options.uri));
Expand Down
1 change: 1 addition & 0 deletions health/db-sync-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = exports = new (class DBSyncStateCheck extends nHealthCheck {
})({
businessImpact: 'The Syndication database\'s computed tables are not in-sync with the base table data and, as such, may be showing incorrect data to users.',
name: 'Syndication database data integrity',
id: 'next-syndication-api-db-data-integrity',
/*eslint-disable*/
panicGuide: `To force a reload of all the computed tables, run:
Expand Down
1 change: 1 addition & 0 deletions health/error-spikes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = nHealth.runCheck({
threshold,
samplePeriod: `${samplePeriod}min`,
name: `${statusCode} rate for articles is acceptable`,
id: 'next-syndication-api-error-spikes',
severity: 1,
businessImpact: `Error rate for the syndication-api has exceeded a threshold of ${threshold * 100}% over the last ${samplePeriod} minutes.`,
technicalSummary: `The proportion of ${statusCode} (Unauthorized) responses for syndication API requests across all heroku dynos vs all responses is higher than a threshold of ${threshold} over the last ${samplePeriod} minutes`,
Expand Down
1 change: 1 addition & 0 deletions health/sqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ module.exports = exports = new (class SQSCheck extends nHealthCheck {
})({
businessImpact: 'Saved and downloaded items are not currently being processed by the Syndication API and, as such, are backing up in the Syndication SQS Queue.',
name: 'Syndication SQS Queue message processing',
id: 'next-syndication-api-sqs',
/*eslint-disable*/
panicGuide: `1. check SQS Queue (next-syndication-downloads-prod) on Infra Prod to see if there are messages outstanding on the queue (Monitoring --> Approximate Number Of Messages Visible chart, or, Send and Recieve Messages --> Poll for Messages --> inspect the message id for message details).
2. If there is a message in the queue, check/tail the server/worker logs on Heroku:
Expand Down

0 comments on commit 603d9e7

Please sign in to comment.