Most web frameworks let you know the amount of time that it took to process a certain page request. I'm starting to work with Flask framework now and am very much in need of this information but can't find any good way of getting it. Using the werkzeug Midleware profiler is an option, but it is very verbose and provides too much information, I would ideally want to see in the basic log output "request info - 0.2s" or whatever the time is. Is there a way of doing this? Also, is there anyway of doing this same thing with SQLite? I.e., getting a count of the number of sqlite calls and their times for a specific request?
##### Flask-profiler measures endpoints defined in your flask application; and provides you fine-grained report through a web interface.
When the Flask application handles a request, it creates a Request object based on the environment it received from the WSGI server. Because a worker (thread, process, or coroutine depending on the server) handles only one request at a time, the request data can be considered global to that worker during that request.
For reference, the Flask benchmarks on techempower give 25,000 requests per second.
You should have a look at flask-debugtoolbar
, it's basically the same as the django-debug-toolbar
(if you ever used it) ported to Flask
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With