18 lines
520 B
Python
18 lines
520 B
Python
import logging
|
|
from prometheus_fastapi_instrumentator import Instrumentator
|
|
|
|
|
|
def register(app):
|
|
# Prometheus metric prefix is : freeleaps_metrics
|
|
instrumentator = (
|
|
Instrumentator().instrument(
|
|
app,
|
|
metric_namespace="freeleaps",
|
|
metric_subsystem="metrics", )
|
|
)
|
|
|
|
@app.on_event("startup")
|
|
async def startup():
|
|
instrumentator.expose(app, endpoint="/api/_/metrics", should_gzip=True)
|
|
logging.info("Metrics endpoint exposed at /api/_/metrics")
|