idirlab / covid19

GNU General Public License v3.0
2 stars 0 forks source link

Enable big brother #36

Closed v3nd3774 closed 4 years ago

v3nd3774 commented 4 years ago

Storing this task:

image

This task encompasses adding an endpoint onto the data-serving API that responds to an HTTP GET request with a JSON object.

Big brother will then parse the JSON object to understand the state of the API for monitoring.


The JSON object should have this format: {
"use_groups":true, "size":2, "interval":15, "API Routes":{ "size":4, "Score Text (BERT)":200, "Score Text (BiLSTM)":200, "Score Text (SVM)":200, "API Docs":200 }, "Claimbuster Website":{ "size":2, "Debates":200, "Fact Checker":200 } }

"use_groups":true - set to true "interval":15 - 15 minutes, how often Big brother should check in with the API "size":2 - number of groups, a group is a key that is not "use_groups", "size" or "interval"

a group looks like:

key = Name of logical group of endpoints value = dictionary with a 'size' key that corresponds to how many non-'size' keys are in the dictionary each key is treated as an endpoint, where the value should be the http response to querying that endpoint (200 is OK, anything else is BAD).


Suggested Groups:

"Data Sources" : {size: n, data_source_1:200, ..., data_source_n:200} "Query Endpoints": {all the query endpoints here}


Notes:

Query local host instead of idir.uta.edu

A dictionary may be an easy way to just do a for k, v in dict.items() to easily create the responses: For the example JSON the structure is like this:

test_urls = { "API Routes": { "Score Text (BERT)":"http://127.0.0.1:5001/claimbuster/api/v2/score/text/test", "Score Text (BiLSTM)":"http://127.0.0.1:5001/claimbuster/api/v2/bilstm/score/text/test", "Score Text (SVM)":"http://127.0.0.1:5001/claimbuster/api/v2/svm/score/text/test", "API Docs":"http://127.0.0.1:5001/claimbuster/api/docs/" }, "Claimbuster Website": { "Debates":"http://127.0.0.1:5001/claimbuster/debates/", "Fact Checker":"http://127.0.0.1:5001/claimbuster/factchecker/", } }

v3nd3774 commented 4 years ago

api in branch big_bro responds with expected output to accomplish this task now:

jsonresponse

v3nd3774 commented 4 years ago

Availible on dev: https://idir.uta.edu/covid-19-api-dev/api/v1/ping

v3nd3774 commented 4 years ago

Availible on prod: https://idir.uta.edu/covid-19-api/api/v1/ping