https://github.com/agent-hellboy/flask-crlatency
A flask extension to log route latency
https://github.com/agent-hellboy/flask-crlatency
Last synced: 29 days ago
JSON representation
A flask extension to log route latency
- Host: GitHub
- URL: https://github.com/agent-hellboy/flask-crlatency
- Owner: Agent-Hellboy
- License: mit
- Created: 2023-08-10T16:14:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-29T03:38:29.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T15:42:12.717Z (over 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
flask-crlatency (flask-check-route-latency)
===========================================
A flask extension to log route latency
Installation
------------
pip install flask-crlatency
Example
-------
.. code:: py
from flask import Flask
from flask_crlatency import RouteLatencyLogger
app = Flask(__name__)
app.config["SECRET_KEY"] ="your_secret_key"
app.config["DEBUG"] = True
app.config["MAX_ROUTE_LATENCY"] = 0.1
latency_logger = RouteLatencyLogger(app)
@app.route("/")
def index():
return "Hello, World!"
if __name__ == "__main__":
app.run()
response:
[2023-08-19 10:00:58,654] WARNING in __init__: High latency for route index: 3.001345 seconds
127.0.0.1 - - [19/Aug/2023 10:00:58] "GET / HTTP/1.1" 200 -