+ prometheus
This commit is contained in:
4
aiws.py
4
aiws.py
@@ -13,6 +13,7 @@ from dotenv import load_dotenv
|
||||
from fastapi import FastAPI
|
||||
from motor.motor_asyncio import AsyncIOMotorClient
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
from prometheus_fastapi_instrumentator import Instrumentator
|
||||
|
||||
# --- ИМПОРТЫ ПРОЕКТА ---
|
||||
from adapters.google_adapter import GoogleAdapter
|
||||
@@ -169,6 +170,9 @@ async def lifespan(app: FastAPI):
|
||||
# --- НАСТРОЙКА FASTAPI ---
|
||||
app = FastAPI(title="Assets API", lifespan=lifespan)
|
||||
|
||||
# Prometheus Metrics
|
||||
Instrumentator().instrument(app).expose(app)
|
||||
|
||||
# CORS
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
|
||||
@@ -50,3 +50,4 @@ passlib[argon2]==1.7.4
|
||||
python-jose[cryptography]==3.3.0
|
||||
python-multipart==0.0.22
|
||||
email-validator
|
||||
prometheus-fastapi-instrumentator
|
||||
|
||||
Reference in New Issue
Block a user