add FastApi实时性能监控

This commit is contained in:
jxxghp
2025-08-01 17:47:55 +08:00
parent 8ab233baef
commit 1dd3af44b5
10 changed files with 857 additions and 21 deletions
+4
View File
@@ -2,6 +2,7 @@ from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.core.config import settings
from app.monitoring import setup_prometheus_metrics
from app.startup.lifecycle import lifespan
@@ -24,6 +25,9 @@ def create_app() -> FastAPI:
allow_headers=["*"],
)
# 设置性能监控
setup_prometheus_metrics(_app)
return _app