Contents

starlette_prometheus example

0

A complete example that exposes prometheus metrics endpoint under /metrics/ path in starlette.

from starlette.applications import Starlette
from starlette_prometheus import metrics, PrometheusMiddleware

app = Starlette()

app.add_middleware(PrometheusMiddleware)
app.add_route("/metrics/", metrics)

Code example provided in the readme file of the starlette-wtf project on github.

About starlette-prometheus

starlette-prometheus - is a Prometheus integration for Starlette.