Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions routers/bot_orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,30 @@ async def get_bot_runs(
raise HTTPException(status_code=500, detail=str(e))


@router.get("/bot-runs/stats")
async def get_bot_run_stats(
db_manager: AsyncDatabaseManager = Depends(get_database_manager)
):
"""
Get statistics about bot runs.

Args:
db_manager: Database manager dependency

Returns:
Bot run statistics
"""
try:
async with db_manager.get_session_context() as session:
bot_run_repo = BotRunRepository(session)
stats = await bot_run_repo.get_bot_run_stats()

return {"status": "success", "data": stats}
except Exception as e:
logger.error(f"Failed to get bot run stats: {e}")
raise HTTPException(status_code=500, detail=str(e))


@router.get("/bot-runs/{bot_run_id}")
async def get_bot_run_by_id(
bot_run_id: int,
Expand Down Expand Up @@ -442,30 +466,6 @@ async def delete_bot_run(
raise HTTPException(status_code=500, detail=str(e))


@router.get("/bot-runs/stats")
async def get_bot_run_stats(
db_manager: AsyncDatabaseManager = Depends(get_database_manager)
):
"""
Get statistics about bot runs.

Args:
db_manager: Database manager dependency

Returns:
Bot run statistics
"""
try:
async with db_manager.get_session_context() as session:
bot_run_repo = BotRunRepository(session)
stats = await bot_run_repo.get_bot_run_stats()

return {"status": "success", "data": stats}
except Exception as e:
logger.error(f"Failed to get bot run stats: {e}")
raise HTTPException(status_code=500, detail=str(e))


async def _background_stop_and_archive(
bot_name: str,
container_name: str,
Expand Down
Loading