index-metric
All checks were successful
Deploy on push / deploy (push) Successful in 5m45s

This commit is contained in:
2025-08-30 21:20:01 +03:00
parent 906c9bbdf4
commit 98f625ec0d
2 changed files with 7 additions and 9 deletions

View File

@@ -75,6 +75,7 @@ graphql_app = GraphQL(
# Оборачиваем GraphQL-обработчик для лучшей обработки ошибок
async def graphql_handler(request: Request) -> Response:
"""
Обработчик GraphQL запросов с поддержкой middleware и обработкой ошибок.

View File

@@ -9,9 +9,10 @@ import numpy as np
from settings import MUVERA_INDEX_NAME, SEARCH_MAX_BATCH_SIZE, SEARCH_PREFETCH_SIZE
from utils.logger import root_logger as logger
# Простые метрики производительности поиска
class SearchMetrics:
def __init__(self):
def __init__(self) -> None:
self.indexing_start_time: float | None = None
self.documents_indexed: int = 0
@@ -26,6 +27,7 @@ class SearchMetrics:
rate = self.documents_indexed / duration if duration > 0 else 0
print(f"✅ Индексация завершена за {duration:.2f}s ({rate:.1f} doc/s)")
# Глобальный экземпляр метрик
search_metrics = SearchMetrics()
@@ -147,12 +149,7 @@ class SearchService:
# Get Muvera service info
if self.muvera_client:
muvera_info = await self.muvera_client.info()
return {
"status": "enabled",
"provider": "muvera",
"mode": "local",
"muvera_info": muvera_info
}
return {"status": "enabled", "provider": "muvera", "mode": "local", "muvera_info": muvera_info}
return {"status": "error", "message": "Muvera client not available"}
except Exception:
logger.exception("Failed to get search info")