Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request and basic profiling information for Flask

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?

like image 333
Michael Avatar asked Aug 16 '11 21:08

Michael


People also ask

What is Flask profiler?

##### Flask-profiler measures endpoints defined in your flask application; and provides you fine-grained report through a web interface.

How do you handle requests in Flask?

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.

How many requests per second can Flask handle?

For reference, the Flask benchmarks on techempower give 25,000 requests per second.


1 Answers

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.

like image 144
mdeous Avatar answered Sep 24 '22 00:09

mdeous