@@ -9,12 +9,12 @@ In order to monitor correctly their environments, backend services require a Hea
9
9
## Checks
10
10
11
11
- [ ] 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
14
14
15
15
## Examples
16
16
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
18
18
19
19
### Example 1: Bad example
20
20
@@ -42,7 +42,7 @@ app.get("/health", async (req, res) => {
42
42
43
43
- There is a call to one of the database but not the other
44
44
- 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
46
46
47
47
### Example 3: Good example
48
48
@@ -60,7 +60,7 @@ RDS.getHealth = async () => {
60
60
await knex .raw (" select 1+1 as result" );
61
61
};
62
62
63
- DynamoDB .getDynamoHealth = (): Promise < Array < Object >> => {
63
+ DynamoDB .getDynamoHealth = () => {
64
64
return new Promise ((resolve , reject ) => {
65
65
dynamodb .describeTable ({ TableName: dynamodbTableName }, (error , data ) => {
66
66
if (error) {
0 commit comments