get_pipeline_exec_history
所属分类:运维诊断 · Tool 名称:
get_pipeline_exec_history
功能说明
获取指定管道最近 N 次批量同步的执行记录,包括每次执行的任务 ID、状态、起止时间与耗时。适用于「最近一周的执行成功率怎么样」「最近几次同步有没有变慢」这类趋势性问题的分析。
输入参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
pipeline | string | 是 | 管道名称(可通过 list_pipeline 获取) |
limit | integer | 否 | 返回最近几次记录,默认 10 |
输出结果
业务 JSON 直返(非信封结构),字段说明如下:
| 字段 | 类型 | 说明 |
|---|---|---|
pipeline | string | 管道名称(回显入参) |
history | array | 执行历史记录列表,按任务 ID 倒序(最新在前) |
history[].taskId | integer | 任务 ID,可作为 get_task_log 的 taskId 入参 |
history[].status | string | 执行状态:SUCCESS(成功)/ FAILD(失败)/ DOING(执行中)/ ASYN_DOING(异步执行中)/ CANCEL(已终止) |
history[].startTime | string | 开始时间,格式 yyyy-MM-dd HH:mm:ss |
history[].endTime | string | 结束时间,格式 yyyy-MM-dd HH:mm:ss |
history[].durationSec | integer | 本次执行耗时(秒);起止时间不完整时该字段不出现 |
返回示例
{
"pipeline": "mysql2doris_orders",
"history": [
{
"taskId": 1024,
"status": "SUCCESS",
"startTime": "2026-07-29 08:25:00",
"endTime": "2026-07-29 08:30:12",
"durationSec": 312
},
{
"taskId": 1023,
"status": "FAILD",
"startTime": "2026-07-28 08:25:00",
"endTime": "2026-07-28 08:27:41",
"durationSec": 161
}
]
}
错误返回
| 情况 | 表现 |
|---|---|
pipeline 为空 | MCP 层 isError: true,内容为参数错误描述文本 |
| 服务端内部异常 | MCP 层 isError: true,内容为通用错误提示文本 |
注意点
- 管道不存在或从未执行时,返回成功且
history为空数组,不会显式报错。 limit小于等于 0 时按默认值 10 处理。- 发现某次执行失败(
status: "FAILD")后,可用对应的taskId调用get_task_log查看失败日志。 - 本 Tool 仅覆盖批量同步的执行历史;增量同步是长驻进程,无执行历史的概念,其状态请使用
get_incr_sync_status。
典型用法
在 Hermes 中的提问示例:
mysql2doris_orders 最近 10 次同步的成功率怎么样?
使用 get_pipeline_exec_history 工具:看看 mysql2doris_orders 最近几次同步耗时有没有变长