freeleaps-authentication/webapi/providers/metrics.py

13 lines
555 B
Python
Raw Normal View History

2025-10-30 03:26:05 +00:00
import logging
from prometheus_fastapi_instrumentator import Instrumentator
from common.config.app_settings import app_settings
def register(app):
instrumentator = Instrumentator().instrument(app,
metric_namespace="freeleaps",
metric_subsystem=app_settings.APP_NAME)
@app.on_event("startup")
async def startup():
instrumentator.expose(app, endpoint="/api/_/metrics", should_gzip=True)
logging.info("Metrics endpoint exposed at /api/_/metrics")