Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

[FEATURE] Health check for API #306

Open
ramyaragupathy opened this issue Aug 16, 2022 · 5 comments · May be fixed by #311
Open

[FEATURE] Health check for API #306

ramyaragupathy opened this issue Aug 16, 2022 · 5 comments · May be fixed by #311
Assignees

Comments

@ramyaragupathy
Copy link
Member

Similar to Tasking Manager API - https://tasking-manager-tm4-production-api.hotosm.org/api/v2/system/heartbeat/ - it will be good to have one simple endpoint in Galaxy API that checks for the accessibility status.

cc @kshitijrajsharma @emi420 @dakotabenjamin @eternaltyro

@d-rita d-rita linked a pull request Aug 30, 2022 that will close this issue
@kshitijrajsharma
Copy link
Member

IMO health check for each endpoint with the sample request or may be with dummy dataset wrt production API or checkout the latest code on the master ! I really liked the health check for the github ! https://www.githubstatus.com/
With this practice when there is a new endpoint developer is required to setup a health check for that particular endpoint with the dummy dataset or request !

@d-rita
Copy link
Contributor

d-rita commented Sep 7, 2022

How would the dummy dataset work? From the articles I have read so far, we would have to use an external service like New Relic, Postman, etc to monitor the API endpoints at given intervals. Codewise, we can monitor dependencies like the databases. If you have a resource that could help with this task, could you please share it? cc: @kshitijrajsharma

@kshitijrajsharma
Copy link
Member

kshitijrajsharma commented Sep 9, 2022

Yeah , Dummy dataset is a .sql file which will be can be used for tests for specific input in the Api endpoint while specifying the output of API . I have done one for Mapathon summary endpoint , which will not only validate the query but it will run the actual workflow and tests the output of that endpoint in tests In that way we can be sure that endpoint is working code wise and for the real production API link , basically Idea is to do it from production by setting up services , And the sample request body can lie inside repo and should be dynamic so that service can pick it from for respective endpoints @eternaltyro will have more insight on this since we are discussing API health check for each endpoint during previous deployment ! For this PR , we can start with database link and improvise , I would love to hear from @robsavoye and @ramyaragupathy

@ramyaragupathy
Copy link
Member Author

@d-rita @kshitijrajsharma - let's start with a simple endpoint, that returns the status of the backend API server. Once that's in place, we can create checks for different endpoints.

@d-rita
Copy link
Contributor

d-rita commented Sep 22, 2022

From today's discussion: the plan is to create a /health/ endpoint where we shall test that different API endpoints are working as expected, i.e. authentication, mapathon summary, mapathon detail, and raw data for the start. If an endpoint returns a 200 OK response, then it is working fine and hence healthy. If not, it's unhealthy.
This /health endpoint will help API users know the status of particular endpoints they are using and create checks for them as needed.

Details:

  • GET API endpoint : /health/
  • Returns:
  {
     authentication: healthy/unhealthy,
     mapathon_summary: healthy/unhealthy,
     mapathon_detail: healthy/unhealthy,
     raw_data: healthy/unhealthy 
  }

If there is more to add, @ramyaragupathy, @kshitijrajsharma please do.
cc: @emi420 @eternaltyro

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants