-
Notifications
You must be signed in to change notification settings - Fork 5
API health check #311
base: develop
Are you sure you want to change the base?
API health check #311
Conversation
0ed8991
to
13d7d60
Compare
- Add API monitoring config variables; API URL and access token - Monitor authentication, raw data and mapathon endpoints - Add system health validation models
13d7d60
to
e69ce11
Compare
get_req = requests.get(endpoint) | ||
return get_req.status_code | ||
if request_type == 'POST': | ||
post_req = requests.post(endpoint, json=body, headers={'access-token':ACCESS_TOKEN}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question , I can see from the website that access_token is not going to expire but have you tried it ? Do they remain same all the time ? Since you are reading it from config , I am just concerned if they will expire or not . Generally access token do expire
@@ -83,6 +83,9 @@ | |||
"value not supported for file_upload_method ,switching to default disk method") | |||
use_s3_to_upload = False | |||
|
|||
MAIN_API_URL = config.get("API_MONITORING", "MAIN_API_URL", fallback="http://127.0.0.1:8000/v1/") | |||
ACCESS_TOKEN = config.get("API_MONITORING", "ACCESS_TOKEN", fallback=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be checking and raising the error if access_token is not supplied would be fruitful since the monitoring depends on it , API should be able to run without those configuration , you can check if it is supplied or not when endpoint is called !
@@ -0,0 +1,36 @@ | |||
raw_data_testing_query = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving these to /src/tests/fixtures will be fruitful
@@ -49,6 +49,10 @@ env=dev | |||
#env=dev # default is prod , supported values are dev and prod | |||
#shp_limit=6000 # in mb default is 4096 | |||
|
|||
#[API_MONITORING] | |||
#MAIN_API_URL=http://127.0.0.1:8000/v1/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming to API URL ?
What does this PR do?
This PR adds an endpoint
/health/
to check if the following endpoints are working as expected, i.e. authentication, mapathon summary, mapathon detail, and raw data.How to test:
git fetch origin && git checkout feature/health-check
to pull the branch.config.txt
, under the [API_MONITORING] header, add these:MAIN_API_URL=http://127.0.0.1:8000/v1
ACCESS_TOKEN=''
NB: The access token is generated using valid credentials of an OSM account. Follow these steps on how to generate a valid token to test authenticated routes in Galaxy.
uvicorn API.main:app --reload
Issues: