Add metrics and refactor healthcheck

This commit is contained in:
2022-02-12 13:58:39 +03:00
parent 19fe00335e
commit 11a283a721
5 changed files with 63 additions and 15 deletions

View File

@@ -74,9 +74,7 @@ async def create_language(data: CreateLanguage):
return await Language.objects.create(**data.dict())
healthcheck_router = APIRouter(
tags=["healthcheck"], dependencies=[Depends(check_token)]
)
healthcheck_router = APIRouter(tags=["healthcheck"])
@healthcheck_router.get("/healthcheck")

View File

@@ -2,6 +2,7 @@ from fastapi import FastAPI
import aioredis
from fastapi_pagination import add_pagination
from prometheus_fastapi_instrumentator import Instrumentator
from app.views import users_router, languages_router, healthcheck_router
from core.config import env_config
@@ -38,4 +39,6 @@ def start_app() -> FastAPI:
if database_.is_connected:
await database_.disconnect()
Instrumentator().instrument(app).expose(app, include_in_schema=True)
return app