Skip to content

rob-blackbourn/bareASGI-prometheus

Repository files navigation

bareASGI-prometheus

Prometheus metrics for bareASGI (read the docs).

Installation

Install from the pie store

$ pip install bareASGI-prometheus

Usage

The middleware can either be configured manually or with a helper.

Manual Configuration

from bareasgi import Application
from bareasgi_prometheus import PrometheusMiddleware, prometheus_view

...

prometheus_middleware = PrometheusMiddleware()
app = Application(middlewares=[prometheus_middleware])
app.http_router.add({'GET'}, '/metrics', prometheus_view)

Helper Configuration

from bareasgi import Application
from bareasgi_prometheus import add_prometheus_middleware

...

app = Application()
add_prometheus_middleware(app)