Skip to content

Commit b6db95b

Browse files
author
flashduty-bot
committed
docs(monit): document datasource query tools on the invoke entry
1 parent 26a97c5 commit b6db95b

8 files changed

Lines changed: 1514 additions & 86 deletions

File tree

‎api-reference/monitors.openapi.en.json‎

Lines changed: 377 additions & 20 deletions
Large diffs are not rendered by default.

‎api-reference/monitors.openapi.zh.json‎

Lines changed: 377 additions & 20 deletions
Large diffs are not rendered by default.

‎api-reference/openapi.en.json‎

Lines changed: 377 additions & 20 deletions
Large diffs are not rendered by default.

‎api-reference/openapi.zh.json‎

Lines changed: 377 additions & 20 deletions
Large diffs are not rendered by default.

‎en/developer/cli.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ flashduty monit datasource-tools-invoke <datasource-id> --tool 'redis_node.slowl
503503

504504
Semantics and limits:
505505

506-
- **No tool catalog, no auto-replay, no fallback**: one call runs exactly one named tool; fill parameters according to the datasource tool's contract rather than guessing from the command list. The `mysql.query` / `postgres.query` tools have been removed — free SQL stays under `monit-query data`.
506+
- **No tool catalog, no auto-replay, no fallback**: one call runs exactly one named tool; fill parameters according to the datasource tool's contract rather than guessing from the command list. Alongside diagnostic tools, the entry also supports `<type>.query` query tools (`prometheus`, `mysql`, `postgres`, `oracle`, `clickhouse`, `elasticsearch`, `loki`, `victorialogs`, `sls`, `tencent_cls`); the `monit-query data` entry stays unchanged.
507507
- Requires **all** currently online routable Edge sessions in the cluster to support the v0.71.0 base invoke protocol (individual tools may require a newer implementation); normal datasource queries retain their existing version compatibility.
508-
- Request body limit 128 KiB; complete success response limit 1 MiB; tool timeout at most 25 seconds.
508+
- Request body limit 128 KiB; complete success response limit 10 MiB; tool timeout at most 25 seconds.
509509
- The datasource must have `enabled=true`; `alerting_enabled=false` does not block diagnostics.
510510
- Response: `data` (tool-specific JSON evidence, preserved without conversion, never null, no legacy diagnose envelope), `tool`, `datasource_id`, optional `summary`, and a `truncated` object (with `reason`; its presence indicates truncation).
511511

‎en/developer/go-sdk.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Endpoints are grouped by service and hang off the client: the call convention is
186186

187187
`client.Diagnostics.QueryData` runs a synchronous query via `POST /monit/query/data` and returns a stable `query_result.v1` structured result (`result.kind` is one of `frames`, `records`, or `samples`). This API requires monit-edge v0.65.0 or later. For log-pattern and metric-trend analysis, use `client.DataSources.ToolsInvoke` with `prometheus.metric_trends`, `loki.log_patterns`, or `victorialogs.log_patterns`.
188188

189-
`client.DataSources.ToolsInvoke` (`POST /monit/datasource/tools/invoke`, `monit-datasource-tools-invoke`) executes one deterministic tool against a configured datasource: `tool` is a single tool name prefixed by the datasource type (e.g. `mysql.overview`), and `params` is the tool-specific JSON parameters (omitted means `{}`; an explicit `null` is invalid). Free SQL goes through `/monit/query/data`; `mysql.query` and `postgres.query` are unsupported. It requires all currently online routable Edge sessions in the cluster to support the v0.71.0 base invoke protocol (individual tools may require a newer implementation), and there is no tool catalog, no automatic replay, and no fallback to legacy diagnose. The request body limit is 128 KiB, the complete success response limit is 1 MiB, and the tool timeout is at most 25 seconds; the response is a `DatasourceToolResult` (`data` is tool-specific JSON, never null, `summary` is optional, and a `truncated` object with `reason` indicates truncation).
189+
`client.DataSources.ToolsInvoke` (`POST /monit/datasource/tools/invoke`, `monit-datasource-tools-invoke`) executes one deterministic tool against a configured datasource: `tool` is a single tool name prefixed by the datasource type (e.g. `mysql.overview`), and `params` is the tool-specific JSON parameters (omitted means `{}`; an explicit `null` is invalid). Alongside diagnostic tools, the entry supports `<type>.query` query tools (`prometheus`, `mysql`, `postgres`, `oracle`, `clickhouse`, `elasticsearch`, `loki`, `victorialogs`, `sls`, `tencent_cls`); the `/monit/query/data` entry stays unchanged. It requires all currently online routable Edge sessions in the cluster to support the v0.71.0 base invoke protocol (individual tools may require a newer implementation), and there is no tool catalog, no automatic replay, and no fallback to legacy diagnose. The request body limit is 128 KiB, the complete success response limit is 10 MiB, and the tool timeout is at most 25 seconds; the response is a `DatasourceToolResult` (`data` is tool-specific JSON, never null, `summary` is optional, and a `truncated` object with `reason` indicates truncation).
190190

191191
For `client.DataSources`, the `payload` selects a type-specific configuration block by `type_ident`. Fifteen `type_ident` values are allowed: `prometheus`, `loki`, `mysql`, `oracle`, `postgres`, `clickhouse`, `elasticsearch`, `sls`, `tencent_cls`, `victorialogs`, plus the new diagnostic-only types `redis_node`, `redis_sentinel`, `mongodb_mongod`, `mongodb_mongos`, and `kafka` — diagnostic-only types always have `alerting_enabled` false (which does not block non-alerting queries or tools) and reject true. Connection address rules: Redis/MongoDB diagnostic types take a single `host:port` (bracket IPv6), with no URI, userinfo, or query; `kafka` takes 1–32 unique comma-separated `host:port` bootstrap addresses (at most 4096 characters after normalization, and the payload has no broker list); for `mongodb_mongod` / `mongodb_mongos` the configuration block's `auth_source` defaults to `admin`, username and password must be configured together, and client certificates are unsupported; the Redis node configuration's `database` defaults to 0. Sensitive fields such as the diagnostic types' `password` and Kafka's `tls_key` support `${env:NAME}` references: literal values are omitted from responses (only `${env:...}` references are echoed back), omitting the fields on update preserves the stored values, and explicitly sending an empty string clears them.
192192

‎zh/developer/cli.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ flashduty monit datasource-tools-invoke <datasource-id> --tool 'redis_node.slowl
503503

504504
语义与限制:
505505

506-
- **无工具目录、无自动重试、无回退**:一次调用只执行一个命名工具,参数需按各数据源工具约定填写,不要从命令行列表猜测。`mysql.query` / `postgres.query` 工具已移除——自由 SQL 请用 `monit-query data`。
506+
- **无工具目录、无自动重试、无回退**:一次调用只执行一个命名工具,参数需按各数据源工具约定填写,不要从命令行列表猜测。除诊断工具外,入口还支持 `<type>.query` 查询工具(`prometheus`、`mysql`、`postgres`、`oracle`、`clickhouse`、`elasticsearch`、`loki`、`victorialogs`、`sls`、`tencent_cls`),`monit-query data` 入口保持不变。
507507
- 要求所选集群内**全部**当前在线可路由的 Edge 会话支持 v0.71.0 基础调用协议(个别工具可能要求更新的实现);普通数据源查询不受此版本限制。
508-
- 请求体 ≤128 KiB;完整成功响应 ≤1 MiB;工具超时 ≤25 秒。
508+
- 请求体 ≤128 KiB;完整成功响应 ≤10 MiB;工具超时 ≤25 秒。
509509
- 需要数据源 `enabled=true`;`alerting_enabled=false` 不阻塞诊断。
510510
- 返回值:`data`(工具特定的 JSON 证据,原样保留、永不为 null,不含旧 diagnose 信封)、`tool`、`datasource_id`、可选 `summary`,以及 `truncated` 对象(含 `reason`,存在即表示结果被截断)。
511511

‎zh/developer/go-sdk.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ client, err := flashduty.NewClient("YOUR_APP_KEY",
186186

187187
`client.Diagnostics.QueryData` 通过 `POST /monit/query/data` 执行同步查询,返回稳定的 `query_result.v1` 结构化结果(`result.kind` 为 `frames` / `records` / `samples` 之一),要求 monit-edge v0.65.0 及以上版本。日志模式和指标趋势分析统一使用 `client.DataSources.ToolsInvoke`,工具名称为 `prometheus.metric_trends`、`loki.log_patterns` 或 `victorialogs.log_patterns`。
188188

189-
`client.DataSources.ToolsInvoke`(`POST /monit/datasource/tools/invoke`,`monit-datasource-tools-invoke`)在某个已配置数据源上执行一个确定性工具:`tool` 名称由数据源类型前缀修饰(如 `mysql.overview`),`params` 为工具专属 JSON 参数(省略视为 `{}`,显式 `null` 非法);自由 SQL 请走 `/monit/query/data`,`mysql.query` 与 `postgres.query` 不受支持。该接口要求集群中所有在线可路由的 Edge 会话都支持 v0.71.0 基础调用协议(单个工具可能要求更新的实现),无工具目录、无自动重放、也不会回退到旧版 diagnose。请求体上限 128 KiB,完整成功响应上限 1 MiB,单工具超时至多 25 秒;响应为 `DatasourceToolResult`(`data` 为工具专属 JSON、永不为 null,`summary` 可选,出现 `truncated` 时其 `reason` 说明截断原因)。
189+
`client.DataSources.ToolsInvoke`(`POST /monit/datasource/tools/invoke`,`monit-datasource-tools-invoke`)在某个已配置数据源上执行一个确定性工具:`tool` 名称由数据源类型前缀修饰(如 `mysql.overview`),`params` 为工具专属 JSON 参数(省略视为 `{}`,显式 `null` 非法);除诊断工具外,入口支持 `<type>.query` 查询工具(`prometheus`、`mysql`、`postgres`、`oracle`、`clickhouse`、`elasticsearch`、`loki`、`victorialogs`、`sls`、`tencent_cls`),`/monit/query/data` 入口保持不变。该接口要求集群中所有在线可路由的 Edge 会话都支持 v0.71.0 基础调用协议(单个工具可能要求更新的实现),无工具目录、无自动重放、也不会回退到旧版 diagnose。请求体上限 128 KiB,完整成功响应上限 10 MiB,单工具超时至多 25 秒;响应为 `DatasourceToolResult`(`data` 为工具专属 JSON、永不为 null,`summary` 可选,出现 `truncated` 时其 `reason` 说明截断原因)。
190190

191191
`client.DataSources` 的 `payload` 按 `type_ident` 选择类型专属配置块。当前允许的 `type_ident` 共 15 种:`prometheus`、`loki`、`mysql`、`oracle`、`postgres`、`clickhouse`、`elasticsearch`、`sls`、`tencent_cls`、`victorialogs`,以及新增的诊断专用类型 `redis_node`、`redis_sentinel`、`mongodb_mongod`、`mongodb_mongos`、`kafka`——诊断专用类型的 `alerting_enabled` 恒为 false(不阻止非告警查询与工具调用),且拒绝传 true。连接地址规则:Redis/MongoDB 诊断类型为单个 `host:port`(IPv6 需加方括号),不接受 URI、userinfo 或 query;`kafka` 为 1–32 个以逗号分隔、互不重复的 `host:port` bootstrap 地址(规范化后至多 4096 字符,`payload` 中不再有 broker 列表);`mongodb_mongod` / `mongodb_mongos` 的配置块中 `auth_source` 默认为 `admin`,用户名与密码必须成对配置,不支持客户端证书;Redis 节点配置的 `database` 默认为 0。诊断类型的 `password` 与 Kafka 的 `tls_key` 等敏感字段支持 `${env:NAME}` 引用:响应中字面值会被省略(仅当存储值本身就是 `${env:...}` 引用时才回显),更新时省略这些字段即保留原值,显式传空字符串则清除。
192192

0 commit comments

Comments
 (0)