qAIRa / qAIRaMapAPI-OpenSource

API for air quality monitoring of gases and dust
https://qaira.github.io/
GNU Lesser General Public License v2.1
4 stars 11 forks source link

What cannot be measured, cannot be improved. #73

Open GersonMontesinos opened 2 years ago

GersonMontesinos commented 2 years ago

Bottlenecks and overloading have become a part of the API due to the fact that we currently do not have any tools or ways to identify the amount of memory or resources required to execute the API's endpoints. We would like to implement and use these tools so that we make sure that whenever we upload more code or functionalities, these won't cause any trouble.

Javiercerna commented 2 years ago

Is this what you have in mind? You can inspect the queries and profile the code for each of your endpoints

image image image

GersonMontesinos commented 2 years ago

Hey @Javiercerna. Yes but I was hoping that there would be a better tool. That's sort of what I get with the middleware on my terminal whenever I execute a query and run the API locally. How do you get that UI or how do you set it up though? It's way better than the printed one from the terminal and I would love to use it

Javiercerna commented 2 years ago

It's flask-debugtoolbar, although with a small change, as noted here: https://github.com/flask-debugtoolbar/flask-debugtoolbar/issues/89. Normally it only works for valid HTML responses (it searches for a <body> tag) and you are returning JSON from most of your endpoints, but it's not difficult to adapt.

I'll open a draft PR later because I might have one or two questions regarding your setup in production (the toolbar should be disabled in production and only work in debug mode).

Could you please tag this issue with the hacktoberfest label? I would like it to count as one of my contributions :smiley:

GersonMontesinos commented 2 years ago

Thanks for your interest @Javiercerna, I'll be looking forward to any questions you have and I'll gladly try to answer them 😄