feat(prometheus): add custom metrics

This commit is contained in:
2025-11-09 12:43:27 +01:00
parent ed3e6329dd
commit ca8287cd8b
3 changed files with 55 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ from fastapi.middleware.cors import CORSMiddleware
from prometheus_fastapi_instrumentator import Instrumentator, metrics
from starlette.requests import Request
from app.services.prometheus import number_of_users, number_of_transactions
from app.services import bank_scraper
from app.workers.celery_tasks import load_transactions, load_all_transactions
from app.models.user import User, OAuthAccount
@@ -50,6 +52,9 @@ fastApi.add_middleware(
prometheus = Instrumentator().instrument(fastApi)
# Register custom metrics
prometheus.add(number_of_users()).add(number_of_transactions())
prometheus.expose(
fastApi,
endpoint="/metrics",