From afb90e55e69ee995c7f9785505d97c94c25f5cc7 Mon Sep 17 00:00:00 2001 From: icecheng Date: Mon, 22 Sep 2025 16:48:07 +0800 Subject: [PATCH] feat: enable metrics --- apps/metrics/webapi/providers/metrics.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/metrics/webapi/providers/metrics.py b/apps/metrics/webapi/providers/metrics.py index 612bbef..18d23d2 100644 --- a/apps/metrics/webapi/providers/metrics.py +++ b/apps/metrics/webapi/providers/metrics.py @@ -1,18 +1,17 @@ import logging from prometheus_fastapi_instrumentator import Instrumentator -from common.config.site_settings import site_settings - def register(app): - instrumentator = ( - Instrumentator().instrument( - app, - metric_namespace="freeleaps-mertics", - metric_subsystem=site_settings.NAME) - ) + # 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") \ No newline at end of file + @app.on_event("startup") + async def startup(): + instrumentator.expose(app, endpoint="/api/_/metrics", should_gzip=True) + logging.info("Metrics endpoint exposed at /api/_/metrics")