Skip to content

Commit ee6d9cc

Browse files
authored
fix(monit): drop agent_elapsed_ms / e2e_elapsed_ms from tool invoke response (#199)
monit-webapi no longer puts per-tool latency in the public /monit/tools/invoke response (b4f5cbd) — both timings now stay in server-side logs only, since they added observability noise for the LLM consumers of the result.
1 parent a095c24 commit ee6d9cc

4 files changed

Lines changed: 12 additions & 68 deletions

File tree

api-reference/monitors.openapi.en.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,7 @@
30183018
"Monitors/Diagnostics"
30193019
],
30203020
"x-mint": {
3021-
"content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **600 requests/minute**; **10 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- Up to **8** tools per call (`MaxToolsPerInvoke`); larger batches must be split client-side. The 8-tool cap aligns with the per-target agent concurrency.\n- Tools execute in parallel on the agent; webapi returns `results[]` aligned with the request `tools[]` order.\n- Long-running: set client timeouts to **at least 35 s**. The endpoint is intended for AI-SRE / human-RCA flows, not interactive UI.\n- Request-level errors (`target_unavailable`, `ambiguous_target_kind`, `unknown_toolset_hash`, `forward_failed`) appear as HTTP 200 with `data.error` set and `data.results = []`.\n- Per-tool failures appear as HTTP 200 with `data.error` absent and `results[i].error` populated — always check **all three** layers (outer envelope `error`, `data.error`, then each `results[i].error`).\n- The response uses **sparse fields**: absent means empty. On success `error` is omitted entirely rather than sent as `null`; on failure `data`, `summary` and `truncated` are omitted. Do not key logic off placeholder `null` fields, and do not expect `target` when the locator could not be uniquely resolved.\n- `results[i].data` is the tool payload with the monit-agent result envelope **already unwrapped** — there is no nested `data.data`. The one-line distillation is `results[i].summary`, and `results[i].truncated` (carrying a `reason`) appears only when the result was genuinely truncated.\n- `results[i].params` echoes the params webapi received for that tool, so batched calls stay correlatable even when an individual tool fails.\n- Each result carries two latency fields: `agent_elapsed_ms` (agent-self-reported, excludes network) and `e2e_elapsed_ms` (webapi-observed end-to-end). A large gap between them indicates network / edge slowness rather than slow tool execution.\n- Construct `tools[].params` against the `input_schema` returned by `/monit/tools/catalog`. For no-arg tools always pass `params: {}` explicitly.",
3021+
"content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **600 requests/minute**; **10 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- Up to **8** tools per call (`MaxToolsPerInvoke`); larger batches must be split client-side. The 8-tool cap aligns with the per-target agent concurrency.\n- Tools execute in parallel on the agent; webapi returns `results[]` aligned with the request `tools[]` order.\n- Long-running: set client timeouts to **at least 35 s**. The endpoint is intended for AI-SRE / human-RCA flows, not interactive UI.\n- Request-level errors (`target_unavailable`, `ambiguous_target_kind`, `unknown_toolset_hash`, `forward_failed`) appear as HTTP 200 with `data.error` set and `data.results = []`.\n- Per-tool failures appear as HTTP 200 with `data.error` absent and `results[i].error` populated — always check **all three** layers (outer envelope `error`, `data.error`, then each `results[i].error`).\n- The response uses **sparse fields**: absent means empty. On success `error` is omitted entirely rather than sent as `null`; on failure `data`, `summary` and `truncated` are omitted. Do not key logic off placeholder `null` fields, and do not expect `target` when the locator could not be uniquely resolved.\n- `results[i].data` is the tool payload with the monit-agent result envelope **already unwrapped** — there is no nested `data.data`. The one-line distillation is `results[i].summary`, and `results[i].truncated` (carrying a `reason`) appears only when the result was genuinely truncated.\n- `results[i].params` echoes the params webapi received for that tool, so batched calls stay correlatable even when an individual tool fails.\n- Construct `tools[].params` against the `input_schema` returned by `/monit/tools/catalog`. For no-arg tools always pass `params: {}` explicitly.",
30223022
"href": "/en/api-reference/monitors/diagnostics/monit-read-tools-invoke",
30233023
"metadata": {
30243024
"sidebarTitle": "Invoke target tools"
@@ -3101,9 +3101,7 @@
31013101
"total_procs": 1036
31023102
}
31033103
},
3104-
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79",
3105-
"agent_elapsed_ms": 3120,
3106-
"e2e_elapsed_ms": 3188
3104+
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79"
31073105
},
31083106
{
31093107
"tool": "net.tcp_ping",
@@ -3115,9 +3113,7 @@
31153113
"error": {
31163114
"code": "timeout",
31173115
"message": "tool \"net.tcp_ping\" exceeded 8000ms"
3118-
},
3119-
"agent_elapsed_ms": 8048,
3120-
"e2e_elapsed_ms": 8217
3116+
}
31213117
}
31223118
]
31233119
}
@@ -5760,16 +5756,6 @@
57605756
}
57615757
},
57625758
"x-flashduty-preserve-absence": true
5763-
},
5764-
"agent_elapsed_ms": {
5765-
"type": "integer",
5766-
"format": "int64",
5767-
"description": "Agent-self-reported tool execution time in milliseconds, excluding network round-trips. May be 0 when the failure occurred before execution started."
5768-
},
5769-
"e2e_elapsed_ms": {
5770-
"type": "integer",
5771-
"format": "int64",
5772-
"description": "Webapi-observed end-to-end time in milliseconds (webapi → ws → edge → agent → ws → webapi). A large gap versus `agent_elapsed_ms` indicates network / edge slowness, not a slow tool."
57735759
}
57745760
}
57755761
}

api-reference/monitors.openapi.zh.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,7 @@
30183018
"Monitors/诊断分析"
30193019
],
30203020
"x-mint": {
3021-
"content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 单次调用至多 **8** 个工具(`MaxToolsPerInvoke`);超出需在客户端拆分。8 个工具的上限与单监控对象 Agent 的并发能力对齐。\n- 工具在 Agent 上并行执行;webapi 返回的 `results[]` 与请求中的 `tools[]` 顺序对齐。\n- 长耗时:客户端超时至少设置 **35 秒**。该接口面向 AI-SRE / 人工排障流程,不适用于交互式 UI。\n- 请求级错误(`target_unavailable`、`ambiguous_target_kind`、`unknown_toolset_hash`、`forward_failed`)以 HTTP 200 返回,`data.error` 不为空,`data.results = []`。\n- 单工具失败以 HTTP 200 返回,`data.error` 不输出,`results[i].error` 被填充——务必同时检查**三层**(外层信封 `error`、`data.error`、再到每个 `results[i].error`)。\n- 响应采用**稀疏字段**:字段不存在即表示为空。成功时 `error` 直接省略而非返回 `null`;失败时 `data`、`summary`、`truncated` 均不输出。不要依赖占位的 `null` 字段做判断;当 locator 无法唯一解析时,`target` 同样不会出现。\n- `results[i].data` 是 Tool 的业务数据,monit-agent 的 result envelope **已被解开**——不会出现嵌套的 `data.data`。一行摘要位于 `results[i].summary`;`results[i].truncated`(内含 `reason`)仅在结果确实被截断时出现。\n- `results[i].params` 回显 webapi 收到的该 Tool 调用参数,便于在批量调用中关联结果——即使其中某个 Tool 失败也能对上号。\n- 每条结果带两个耗时字段:`agent_elapsed_ms`(Agent 自报,不含网络)与 `e2e_elapsed_ms`(webapi 观测的端到端)。两者差距较大表示网络 / 边缘侧慢,而非工具执行慢。\n- 按 `/monit/tools/catalog` 返回的 `input_schema` 构造 `tools[].params`。对于无参工具,务必显式传 `params: {}`。",
3021+
"content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 单次调用至多 **8** 个工具(`MaxToolsPerInvoke`);超出需在客户端拆分。8 个工具的上限与单监控对象 Agent 的并发能力对齐。\n- 工具在 Agent 上并行执行;webapi 返回的 `results[]` 与请求中的 `tools[]` 顺序对齐。\n- 长耗时:客户端超时至少设置 **35 秒**。该接口面向 AI-SRE / 人工排障流程,不适用于交互式 UI。\n- 请求级错误(`target_unavailable`、`ambiguous_target_kind`、`unknown_toolset_hash`、`forward_failed`)以 HTTP 200 返回,`data.error` 不为空,`data.results = []`。\n- 单工具失败以 HTTP 200 返回,`data.error` 不输出,`results[i].error` 被填充——务必同时检查**三层**(外层信封 `error`、`data.error`、再到每个 `results[i].error`)。\n- 响应采用**稀疏字段**:字段不存在即表示为空。成功时 `error` 直接省略而非返回 `null`;失败时 `data`、`summary`、`truncated` 均不输出。不要依赖占位的 `null` 字段做判断;当 locator 无法唯一解析时,`target` 同样不会出现。\n- `results[i].data` 是 Tool 的业务数据,monit-agent 的 result envelope **已被解开**——不会出现嵌套的 `data.data`。一行摘要位于 `results[i].summary`;`results[i].truncated`(内含 `reason`)仅在结果确实被截断时出现。\n- `results[i].params` 回显 webapi 收到的该 Tool 调用参数,便于在批量调用中关联结果——即使其中某个 Tool 失败也能对上号。\n- 按 `/monit/tools/catalog` 返回的 `input_schema` 构造 `tools[].params`。对于无参工具,务必显式传 `params: {}`。",
30223022
"href": "/zh/api-reference/monitors/diagnostics/monit-read-tools-invoke",
30233023
"metadata": {
30243024
"sidebarTitle": "调用监控对象工具"
@@ -3101,9 +3101,7 @@
31013101
"total_procs": 1036
31023102
}
31033103
},
3104-
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79",
3105-
"agent_elapsed_ms": 3120,
3106-
"e2e_elapsed_ms": 3188
3104+
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79"
31073105
},
31083106
{
31093107
"tool": "net.tcp_ping",
@@ -3115,9 +3113,7 @@
31153113
"error": {
31163114
"code": "timeout",
31173115
"message": "tool \"net.tcp_ping\" exceeded 8000ms"
3118-
},
3119-
"agent_elapsed_ms": 8048,
3120-
"e2e_elapsed_ms": 8217
3116+
}
31213117
}
31223118
]
31233119
}
@@ -5760,16 +5756,6 @@
57605756
}
57615757
},
57625758
"x-flashduty-preserve-absence": true
5763-
},
5764-
"agent_elapsed_ms": {
5765-
"type": "integer",
5766-
"format": "int64",
5767-
"description": "Agent 自报的 Tool 执行耗时(毫秒),不含网络往返。若失败发生在执行开始之前,可能为 0。"
5768-
},
5769-
"e2e_elapsed_ms": {
5770-
"type": "integer",
5771-
"format": "int64",
5772-
"description": "WebAPI 观测到的端到端耗时(毫秒,webapi → ws → edge → agent → ws → webapi)。与 `agent_elapsed_ms` 差距很大说明是链路慢,而非 Tool 慢。"
57735759
}
57745760
}
57755761
}

api-reference/openapi.en.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20372,7 +20372,7 @@
2037220372
"Monitors/Diagnostics"
2037320373
],
2037420374
"x-mint": {
20375-
"content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **600 requests/minute**; **10 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- Up to **8** tools per call (`MaxToolsPerInvoke`); larger batches must be split client-side. The 8-tool cap aligns with the per-target agent concurrency.\n- Tools execute in parallel on the agent; webapi returns `results[]` aligned with the request `tools[]` order.\n- Long-running: set client timeouts to **at least 35 s**. The endpoint is intended for AI-SRE / human-RCA flows, not interactive UI.\n- Request-level errors (`target_unavailable`, `ambiguous_target_kind`, `unknown_toolset_hash`, `forward_failed`) appear as HTTP 200 with `data.error` set and `data.results = []`.\n- Per-tool failures appear as HTTP 200 with `data.error` absent and `results[i].error` populated — always check **all three** layers (outer envelope `error`, `data.error`, then each `results[i].error`).\n- The response uses **sparse fields**: absent means empty. On success `error` is omitted entirely rather than sent as `null`; on failure `data`, `summary` and `truncated` are omitted. Do not key logic off placeholder `null` fields, and do not expect `target` when the locator could not be uniquely resolved.\n- `results[i].data` is the tool payload with the monit-agent result envelope **already unwrapped** — there is no nested `data.data`. The one-line distillation is `results[i].summary`, and `results[i].truncated` (carrying a `reason`) appears only when the result was genuinely truncated.\n- `results[i].params` echoes the params webapi received for that tool, so batched calls stay correlatable even when an individual tool fails.\n- Each result carries two latency fields: `agent_elapsed_ms` (agent-self-reported, excludes network) and `e2e_elapsed_ms` (webapi-observed end-to-end). A large gap between them indicates network / edge slowness rather than slow tool execution.\n- Construct `tools[].params` against the `input_schema` returned by `/monit/tools/catalog`. For no-arg tools always pass `params: {}` explicitly.",
20375+
"content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **600 requests/minute**; **10 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- Up to **8** tools per call (`MaxToolsPerInvoke`); larger batches must be split client-side. The 8-tool cap aligns with the per-target agent concurrency.\n- Tools execute in parallel on the agent; webapi returns `results[]` aligned with the request `tools[]` order.\n- Long-running: set client timeouts to **at least 35 s**. The endpoint is intended for AI-SRE / human-RCA flows, not interactive UI.\n- Request-level errors (`target_unavailable`, `ambiguous_target_kind`, `unknown_toolset_hash`, `forward_failed`) appear as HTTP 200 with `data.error` set and `data.results = []`.\n- Per-tool failures appear as HTTP 200 with `data.error` absent and `results[i].error` populated — always check **all three** layers (outer envelope `error`, `data.error`, then each `results[i].error`).\n- The response uses **sparse fields**: absent means empty. On success `error` is omitted entirely rather than sent as `null`; on failure `data`, `summary` and `truncated` are omitted. Do not key logic off placeholder `null` fields, and do not expect `target` when the locator could not be uniquely resolved.\n- `results[i].data` is the tool payload with the monit-agent result envelope **already unwrapped** — there is no nested `data.data`. The one-line distillation is `results[i].summary`, and `results[i].truncated` (carrying a `reason`) appears only when the result was genuinely truncated.\n- `results[i].params` echoes the params webapi received for that tool, so batched calls stay correlatable even when an individual tool fails.\n- Construct `tools[].params` against the `input_schema` returned by `/monit/tools/catalog`. For no-arg tools always pass `params: {}` explicitly.",
2037620376
"href": "/en/api-reference/monitors/diagnostics/monit-read-tools-invoke",
2037720377
"metadata": {
2037820378
"sidebarTitle": "Invoke target tools"
@@ -20455,9 +20455,7 @@
2045520455
"total_procs": 1036
2045620456
}
2045720457
},
20458-
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79",
20459-
"agent_elapsed_ms": 3120,
20460-
"e2e_elapsed_ms": 3188
20458+
"summary": "os.overview cpu=32.66% mem=74.46% swap=not_configured oom_kill_since_boot=2 load1=1.79"
2046120459
},
2046220460
{
2046320461
"tool": "net.tcp_ping",
@@ -20469,9 +20467,7 @@
2046920467
"error": {
2047020468
"code": "timeout",
2047120469
"message": "tool \"net.tcp_ping\" exceeded 8000ms"
20472-
},
20473-
"agent_elapsed_ms": 8048,
20474-
"e2e_elapsed_ms": 8217
20470+
}
2047520471
}
2047620472
]
2047720473
}
@@ -43057,16 +43053,6 @@
4305743053
}
4305843054
},
4305943055
"x-flashduty-preserve-absence": true
43060-
},
43061-
"agent_elapsed_ms": {
43062-
"type": "integer",
43063-
"format": "int64",
43064-
"description": "Agent-self-reported tool execution time in milliseconds, excluding network round-trips. May be 0 when the failure occurred before execution started."
43065-
},
43066-
"e2e_elapsed_ms": {
43067-
"type": "integer",
43068-
"format": "int64",
43069-
"description": "Webapi-observed end-to-end time in milliseconds (webapi → ws → edge → agent → ws → webapi). A large gap versus `agent_elapsed_ms` indicates network / edge slowness, not a slow tool."
4307043056
}
4307143057
}
4307243058
}

0 commit comments

Comments
 (0)