Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sparkmeter/quart-prometheus-logger
A Prometheus logger extension for Quart
https://github.com/sparkmeter/quart-prometheus-logger
hacktoberfest prometheus quart
Last synced: 7 days ago
JSON representation
A Prometheus logger extension for Quart
- Host: GitHub
- URL: https://github.com/sparkmeter/quart-prometheus-logger
- Owner: sparkmeter
- License: mit
- Created: 2020-10-12T22:49:57.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-29T15:29:51.000Z (almost 4 years ago)
- Last Synced: 2023-03-02T23:56:40.757Z (over 1 year ago)
- Topics: hacktoberfest, prometheus, quart
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# quart-prometheus-logger
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 up
* `http_requests_errors`, the number of http error responses returned by the application since it started up
* `http_request_duration_seconds`, the amount of time spent handling http requests
* `http_request_size_bytes`, the size of http requests fulfilled by the application
* `http_response_size_bytes`, the size of http responses returned by the application### Usage
Initialize the extension with the application
```py
from quart import Quartapp = Quart(__name__)
prometheus_registry = PrometheusRegistry(app=app, metrics_endpoint='internal')
```
Or you can use the factory pattern```py
prometheus_registry = PrometheusRegistry(metrics_endpoint='internal')
def create_app()
app = Quart(__name__)
prometheus_registry.init_app(app)
return app
```