@@ -9,12 +9,12 @@ In order to monitor correctly their environments, backend services require a Hea
99## Checks
1010
1111- [ ] Make a call to every database used by the API
12- - [ ] Send a 2xx status code status in case of API running correctly and 5xx status code if not
13- - [ ] Make the less data usage database calls : the health check route is likely to be called very often in short period of time
12+ - [ ] Send a 2xx status code status if the API is running correctly, 5xx status code if not
13+ - [ ] Make database calls retrieving as little data as possible : the health check route is likely to be called very often in short period of time
1414
1515## Examples
1616
17- In the examples below the API is concentrating calls to one database RDS and one DynamoDB
17+ In the examples below the API is making calls to one database RDS and one DynamoDB
1818
1919### Example 1: Bad example
2020
@@ -42,7 +42,7 @@ app.get("/health", async (req, res) => {
4242
4343- There is a call to one of the database but not the other
4444- The call is using too much data
45- - There is a 503 if the DB is down
45+ - There is a 503 if the DB is down: the await RDS.getAllEntries() is then throwing an error hence the catch block is executed
4646
4747### Example 3: Good example
4848
@@ -60,7 +60,7 @@ RDS.getHealth = async () => {
6060 await knex .raw (" select 1+1 as result" );
6161};
6262
63- DynamoDB .getDynamoHealth = (): Promise < Array < Object >> => {
63+ DynamoDB .getDynamoHealth = () => {
6464 return new Promise ((resolve , reject ) => {
6565 dynamodb .describeTable ({ TableName: dynamodbTableName }, (error , data ) => {
6666 if (error) {
0 commit comments