diff --git a/pyproject.toml b/pyproject.toml index 881c239..9237f35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,7 @@ backend = [ ] ml = [ "sentence-transformers>=5.1.2", + "prometheus-fastapi-instrumentator>=7.1.0", "torch", ] types = [ diff --git a/src/template_project/ml/entry_point.py b/src/template_project/ml/entry_point.py index 5814523..695bea8 100644 --- a/src/template_project/ml/entry_point.py +++ b/src/template_project/ml/entry_point.py @@ -11,6 +11,7 @@ from dishka import AsyncContainer from dishka.integrations.fastapi import setup_dishka from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from prometheus_fastapi_instrumentator import Instrumentator from template_project.ml.configuration import load_configuration from template_project.ml.ioc.make import make_ioc @@ -57,6 +58,7 @@ def make_asgi_application( app.include_router(healthcheck.router) app.include_router(embed.router) app.include_router(predict.router) + Instrumentator().instrument(app).expose(app) setup_dishka(container=ioc, app=app)