elixir-europe / biovalidator

JSON validator derived from AJV supporting ontology and taxonomy validation.
Apache License 2.0
19 stars 6 forks source link

[Requested feature] Create a health check endpoint for the server #65

Open M-casado opened 1 year ago

M-casado commented 1 year ago

Summary

Creation of a "Health Check" Endpoint for Biovalidator Server, to be used to determine the operational status and health of a system or service.

Motivation

The addition of a "Health Check" endpoint for the Biovalidator server would provide a convenient way to determine the server's operational status. This feature aims to simplify the process of checking whether the server is up and running or if it has encountered any issues.

Details

The "Health Check" endpoint would be a new API endpoint that can be accessed to verify the status of the Biovalidator server. The endpoint should return a response indicating whether the server is functioning correctly or if it is experiencing any errors or downtime.

When the endpoint is accessed, it should perform a quick internal check to ensure that all necessary services and components of the Biovalidator server are operational. This check should cover critical aspects, for example: checking that other endpoints are accessible, that external service dependencies are accessible, and overall server availability.

The response from the "Health Check" endpoint should include relevant information about the server's status, such as a timestamp of the last check, the server's uptime duration, amount of validation requests since deployment and any specific error messages or warnings if applicable.

Use cases

The "Health Check" endpoint would be beneficial for the following use cases:

Example

To perform a "Health Check" on the Biovalidator server, a GET request would be made to the following mocking endpoint:

GET http://localhost:3020/healthcheck

The response from the server would provide information about the server's current status. A successful response would have a status code of 200 and a JSON payload similar to the following:

{
  "status": "ok",
  "timestamp": "2023-05-24T12:00:00Z",
  "uptime": "2 days 3 hours 30 minutes",
  "requestsNumber": 1930,
  "message": "Server is running smoothly.",
  "externalDependencies": [
        "identifiers.org": { ... },
        "ontologyLookupService": { ... },
        "europeanNucleotideArchive": { ... }
   ]
}

In case of an error or server unavailability, the response would have a status code indicating the issue and an accompanying error message.