Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yannlambret/flstats
A performance monitoring tool for the Flask microframework
https://github.com/yannlambret/flstats
Last synced: about 2 months ago
JSON representation
A performance monitoring tool for the Flask microframework
- Host: GitHub
- URL: https://github.com/yannlambret/flstats
- Owner: yannlambret
- License: other
- Created: 2013-07-09T20:23:30.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-18T14:59:06.000Z (almost 10 years ago)
- Last Synced: 2024-07-24T21:10:18.146Z (2 months ago)
- Language: Python
- Homepage:
- Size: 234 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
flstats
=======A performance monitoring tool for the Flask microframework.
Work in progress, hasn't been tested under heavy load yet. Suggestions and contributions are more than welcome.
A simple example of how to use it based on the [Flask][flask] documentation:
```python
from flask import Flask
from flstats import statistics, webstatisticsapp = Flask(__name__)
app.register_blueprint(webstatistics)@app.route("/")
@statistics
def hello():
return "Hello World!"if __name__ == "__main__":
app.run()
```And that's it, your application now collects statistics that you can access at 'http://localhost:5000/flstats/'.
Data are in the JSON format, so you will get something like this:
{
"stats": [
{
"avg": 72.0,
"max": 282.26,
"min": 61.07,
"throughput": 25,
"url": "http://localhost:5000/"
}
]
}Well, to be honest, if you run the previous code sample on a reasonably modern hardware, you will more likely get
something like this:{
"stats": [
{
"avg": 0.0,
"max": 0.0,
"min": 0.0,
"throughput": 25,
"url": "http://localhost:5000/"
}
]
}
But you get the idea! Each stat "object" have five fields:- url: performance data are related to this specific URL
- max: longest execution time for a request
- min: shortest execution time for a request
- avg: average response time
- throughput: the number of requests processed for this URL beetween two accesses to '/flstats/'. For instance, if you
set up your monitoring system to poll the stats each minute, you will get the number of requests per minute for each URLTime values are expressed in milliseconds.
[flask]: http://flask.pocoo.org/