This commit is contained in:
2026-11-16 16:08:15 +03:00
parent 0497b0c217
commit 442595b37c
29 changed files with 2930 additions and 63 deletions
+7
View File
@@ -18,10 +18,13 @@ from .routers.users import router as users_router
from .routers.chats import router as chats_router
from .routers.auth import router as auth_router
from .routers.attachments import router as attachments_router
from . import telemetry
@asynccontextmanager
async def lifespan(app):
telemetry.setup()
telemetry.seed_http(app.routes)
engine = create_db_engine()
try:
store.sessions = sessionmaker(engine, expire_on_commit=False)
@@ -29,6 +32,7 @@ async def lifespan(app):
finally:
engine.dispose()
sessions.client.close()
telemetry.shutdown()
app = FastAPI(title="MTUSI Messenger", lifespan=lifespan)
@@ -46,3 +50,6 @@ app.include_router(users_router)
app.include_router(chats_router)
app.include_router(auth_router)
app.include_router(attachments_router)
# Outside FastAPI's error middleware: includes generated 500 responses and full streams.
app = telemetry.HttpTelemetry(app)