feat: 添加监控路由和相关功能,更新依赖项以支持新特性,增强服务监控能力

This commit is contained in:
iHeyTang
2025-08-14 14:40:42 +08:00
parent 6240b98c5b
commit 9c72bffd21
5 changed files with 456 additions and 2 deletions

View File

@@ -254,3 +254,21 @@ async def get_running_workflow_runs() -> List[dict]:
runs = result.scalars().all()
return [run.to_dict() for run in runs]
async def get_workflow_runs_recent(start_time: datetime, end_time: datetime) -> List[dict]:
"""获取指定时间范围内的最近工作流运行记录"""
async with AsyncSessionLocal() as session:
stmt = (
select(WorkflowRun)
.where(
WorkflowRun.created_at >= start_time,
WorkflowRun.created_at <= end_time
)
.order_by(WorkflowRun.created_at.desc())
)
result = await session.execute(stmt)
runs = result.scalars().all()
return [run.to_dict() for run in runs]