A Prometheus logger extension for Quart.
This extension collects key request metrics for every endpoint registered in a Quart application. Namely:
http_requests
, the number of http requests fulfilled by the application since it started uphttp_requests_errors
, the number of http error responses returned by the application since it started uphttp_request_duration_seconds
, the amount of time spent handling http requestshttp_request_size_bytes
, the size of http requests fulfilled by the applicationhttp_response_size_bytes
, the size of http responses returned by the application
Initialize the extension with the application
from quart import Quart
app = Quart(__name__)
prometheus_registry = PrometheusRegistry(app=app, metrics_endpoint='internal')
Or you can use the factory pattern
prometheus_registry = PrometheusRegistry(metrics_endpoint='internal')
def create_app()
app = Quart(__name__)
prometheus_registry.init_app(app)
return app