diff --git a/api-reference/monitors.openapi.en.json b/api-reference/monitors.openapi.en.json index e7a1819..2c085d1 100644 --- a/api-reference/monitors.openapi.en.json +++ b/api-reference/monitors.openapi.en.json @@ -33,10 +33,6 @@ "name": "Monitors/Diagnostics", "description": "Diagnostic and query endpoints used by Flashduty AI SRE — ad-hoc data source queries, log/metric diagnostics, and target-side tool invocation." }, - { - "name": "Monitors/Monitor utilities", - "description": "Monitors service activation and data preview utilities." - }, { "name": "Monitors/Service map", "description": "Query network-observed service topology, dependency summaries, and ServiceMap collection status across hosts." @@ -817,83 +813,6 @@ } } }, - "/monit/rule/status": { - "post": { - "operationId": "monit-rule-write-status", - "summary": "Get rule trigger status under folder", - "description": "Return the rule trigger summary for all rules under a folder node and its descendants.", - "tags": [ - "Monitors/Alert rules" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | **Alerting Rules Manage** (`monit`) |\n\n## Usage\n\n- Set `folder_id` to `0` to get summary across all folders.\n- If the folder contains too many rules, computation is skipped for self-protection.", - "href": "/en/api-reference/monitors/alert-rules/monit-rule-write-status", - "metadata": { - "sidebarTitle": "Get rule trigger status under folder" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/RuleStatusResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "folder_id": 100, - "folder_name": "Production", - "rule_total": 10, - "triggered_rule_count": 2 - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleFolderIDRequest" - }, - "example": { - "folder_id": 100 - } - } - } - } - } - }, "/monit/rule/export": { "post": { "operationId": "monit-rule-read-export", @@ -2449,7 +2368,7 @@ "Monitors/Diagnostics" ], "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n| Edge requirement | Supported deployments require **monit-edge v0.65.0 or later** |\n\n## Usage\n\n- Treat **monit-edge v0.65.0** as the minimum supported Edge version for this public API. WebAPI retains migration adapters for older Edge versions: query.v2 results may still preserve frames, records, or samples, while legacy rows can expose only the information they retained. These adapters do not change the support floor; older protocols lack query.v3 cancellation and error-lifecycle semantics, and data already lost by legacy rows cannot be recovered.\n- The public response format is always `query_result.v1` and is independent of the internal Edge query protocol. Dispatch on `result.kind` (`frames`, `records`, or `samples`); do not infer the result shape from `ds_type` or the Edge version.\n- A `frames` result may contain multiple table or time-series frames. Field values are columnar and all fields in one frame have the same length.\n- A `records` result may contain nested JSON and null records. Integer literals outside JavaScript's safe integer range are returned as decimal strings.\n- A `samples` result contains label sets and instant values. A value may be a number or one of the strings `NaN`, `+Inf`, and `-Inf`.\n- The final success response is limited to 8 MiB and query results are limited to 1,000 rows. Narrow the time range, reduce fields, or aggregate at the source when a request exceeds a limit.\n- Query failures use non-2xx HTTP status codes and the standard error envelope. Do not transparently fall back to the deprecated `/monit/query/rows` endpoint.\n- Query execution may take up to 35 seconds across WebAPI forwarding and Edge execution. Configure client timeouts to at least 40 seconds and propagate cancellation when the caller abandons a query.", + "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n| Edge requirement | Supported deployments require **monit-edge v0.65.0 or later** |\n\n## Usage\n\n- Treat **monit-edge v0.65.0** as the minimum supported Edge version for this public API. WebAPI retains migration adapters for older Edge versions: query.v2 results may still preserve frames, records, or samples, while legacy rows can expose only the information they retained. These adapters do not change the support floor; older protocols lack query.v3 cancellation and error-lifecycle semantics, and data already lost by legacy rows cannot be recovered.\n- The public response format is always `query_result.v1` and is independent of the internal Edge query protocol. Dispatch on `result.kind` (`frames`, `records`, or `samples`); do not infer the result shape from `ds_type` or the Edge version.\n- A `frames` result may contain multiple table or time-series frames. Field values are columnar and all fields in one frame have the same length.\n- A `records` result may contain nested JSON and null records. Integer literals outside JavaScript's safe integer range are returned as decimal strings.\n- A `samples` result contains label sets and instant values. A value may be a number or one of the strings `NaN`, `+Inf`, and `-Inf`.\n- The final success response is limited to 8 MiB and query results are limited to 1,000 rows. Narrow the time range, reduce fields, or aggregate at the source when a request exceeds a limit.\n- Query failures use non-2xx HTTP status codes and the standard error envelope. The legacy `/monit/query/rows` endpoint has been removed; use this endpoint for datasource queries.\n- Query execution may take up to 35 seconds across WebAPI forwarding and Edge execution. Configure client timeouts to at least 40 seconds and propagate cancellation when the caller abandons a query.", "href": "/en/api-reference/monitors/diagnostics/monit-read-query-data", "metadata": { "sidebarTitle": "Query structured data" @@ -2563,92 +2482,6 @@ } } }, - "/monit/query/rows": { - "post": { - "operationId": "monit-read-query-rows", - "summary": "Query data source rows", - "description": "Deprecated. Run a synchronous ad-hoc query and return the historical flattened rows shape. Existing consumers should migrate to `/monit/query/data`, which preserves frames, records, and samples without forcing every result into legacy rows.", - "deprecated": true, - "tags": [ - "Monitors/Diagnostics" - ], - "x-mint": { - "content": "## Deprecated\n\nUse [`POST /monit/query/data`](/en/api-reference/monitors/diagnostics/monit-read-query-data) for all new integrations. This endpoint remains available only during the migration of existing UI and AI SRE consumers.\n\n## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- The request is forwarded to `monit-edge` over WebSocket; the data source named by `ds_type` + `ds_name` must already exist under the calling account.\n- `account_id` in the body is optional. When supplied it must equal the authenticated account; mismatched values are rejected.\n- Validation failures use the standard error envelope. When `monit-edge` rejects a query, its `{\"error\": {\"code\": ..., \"message\": ...}}` body is preserved and the HTTP status matches the edge error code; an invalid or absent code becomes HTTP 500. Check both the status and the error body.\n- monit-edge enforces a row cap; large result sets come back as `error.message = \"too many rows\"`. Narrow the time range or aggregate at the source.\n- `args` is a polymorphic `string→string` map that is forwarded verbatim. Semantics depend on `ds_type` (SLS requires `sls.project` + `sls.logstore`; Loki / VictoriaLogs raw mode requires a time range via `*.start`/`*.end` or `*.timespan.value`/`*.timespan.unit`; Prometheus and SQL sources ignore it). See the monit-webapi query-api docs for the per-source key list.", - "href": "/en/api-reference/monitors/diagnostics/monit-read-query-rows", - "metadata": { - "sidebarTitle": "Query data source rows" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRowsRequest" - }, - "example": { - "account_id": 10001, - "ds_type": "prometheus", - "ds_name": "prod-prom", - "expr": "up", - "delay_seconds": 30 - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/QueryRowsResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "fields": { - "__name__": "up", - "instance": "10.0.0.1:9100", - "job": "node" - }, - "values": { - "__value__": 1 - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - } - } - }, "/monit/query/diagnose": { "post": { "operationId": "monit-read-query-diagnose", @@ -2658,7 +2491,7 @@ "Monitors/Diagnostics" ], "x-mint": { - "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- This is a diagnostic / RCA endpoint, not a raw data query — pair it with `/monit/query/rows` when you need detailed rows.\n- Only three `ds_type` and `operation` pairs are supported: `loki` / `victorialogs` → `log_patterns`, and `prometheus` → `metric_trends`. Every other datasource is rejected, even when `operation` is explicit.\n- `methods` selects the analyses to run; when omitted, `log_patterns` defaults to `pattern_snapshot + pattern_compare(previous_window)` and `metric_trends` defaults to `single_window_shape + window_compare(previous_window)`.\n- `time_range` is in Unix seconds; missing or invalid values default to the last 15 minutes; a window wider than 6 hours is rejected.\n- The request is forwarded over WebSocket to `monit-edge`. Long-running: the request may take up to ~30 s on the edge side plus webapi overhead. Set client timeouts to **at least 35 s**.\n- `options.*` are upper-bounded by edge (`max_logs_scanned` ≤ 50 000, `max_patterns` ≤ 50, `examples_per_pattern` ≤ 3, `step_seconds` ∈ [15, 300], `max_series` ≤ 200, `topk` ≤ 50, `timeout_seconds` ≤ 30).\n- Two error layers as with `/monit/query/rows`: edge-level execution errors come back as HTTP 200 with an `error` object in the body — check both layers.\n- Log examples are basic-redacted before being returned; expect `warnings: [\"examples redacted\"]`. Do not treat them as raw logs.", + "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- This is a diagnostic / RCA endpoint, not a raw data query — pair it with `/monit/query/data` when you need detailed rows.\n- Only three `ds_type` and `operation` pairs are supported: `loki` / `victorialogs` → `log_patterns`, and `prometheus` → `metric_trends`. Every other datasource is rejected, even when `operation` is explicit.\n- `methods` selects the analyses to run; when omitted, `log_patterns` defaults to `pattern_snapshot + pattern_compare(previous_window)` and `metric_trends` defaults to `single_window_shape + window_compare(previous_window)`.\n- `time_range` is in Unix seconds; missing or invalid values default to the last 15 minutes; a window wider than 6 hours is rejected.\n- The request is forwarded over WebSocket to `monit-edge`. Long-running: the request may take up to ~30 s on the edge side plus webapi overhead. Set client timeouts to **at least 35 s**.\n- `options.*` are upper-bounded by edge (`max_logs_scanned` ≤ 50 000, `max_patterns` ≤ 50, `examples_per_pattern` ≤ 3, `step_seconds` ∈ [15, 300], `max_series` ≤ 200, `topk` ≤ 50, `timeout_seconds` ≤ 30).\n- Two error layers exist: edge-level execution errors come back as HTTP 200 with an `error` object in the body — check both layers.\n- Log examples are basic-redacted before being returned; expect `warnings: [\"examples redacted\"]`. Do not treat them as raw logs.", "href": "/en/api-reference/monitors/diagnostics/monit-read-query-diagnose", "metadata": { "sidebarTitle": "Diagnose data source" @@ -3150,85 +2983,6 @@ } } }, - "/monit/preview/sync": { - "post": { - "operationId": "monit-preview-sync", - "summary": "Preview datasource query", - "description": "Execute a synchronous datasource query and return the raw result. Used to preview alert rule expressions before saving.", - "tags": [ - "Monitors/Monitor utilities" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **60 requests/minute**; **10 requests/second** per account |\n| Permissions | None — any valid `app_key` can call this operation |\n\n## Usage\n\n- `ds_type` must match the datasource type (e.g. `prometheus`, `loki`).\n- `ds_name` is the display name of the datasource as configured in the account.\n- `delay_seconds` shifts the query window backward by the specified number of seconds, useful for accommodating data ingestion latency.\n- The response body is the raw JSON returned by the datasource — its schema varies by datasource type.", - "href": "/en/api-reference/monitors/monitor-utilities/monit-preview-sync", - "metadata": { - "sidebarTitle": "Preview datasource query" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PreviewSyncResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "status": "success", - "data": { - "resultType": "vector", - "result": [] - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PreviewSyncRequest" - }, - "example": { - "ds_type": "prometheus", - "ds_name": "Prometheus Prod", - "expr": "rate(http_requests_total[5m])", - "delay_seconds": 0 - } - } - } - } - } - }, "/monit/servicemap/status": { "post": { "operationId": "monit-servicemap-read-status", @@ -5845,16 +5599,6 @@ } } }, - "RuleFolderIDRequest": { - "type": "object", - "properties": { - "folder_id": { - "type": "integer", - "format": "uint64", - "description": "Folder ID to summarize. Obtainable via `POST /monit/folder/list`. Trigger statistics are returned grouped by direct child folder." - } - } - }, "RuleIDRequest": { "type": "object", "required": [ @@ -6188,12 +5932,44 @@ ] }, "QueryDataRequest": { - "description": "Request for the stable structured query endpoint. It uses the same query fields as the deprecated rows endpoint.", - "allOf": [ - { - "$ref": "#/components/schemas/QueryRowsRequest" + "type": "object", + "required": [ + "ds_type", + "ds_name", + "expr" + ], + "properties": { + "account_id": { + "type": "integer", + "format": "int64", + "description": "Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account." + }, + "ds_type": { + "type": "string", + "description": "Data source type; must match a configured data source under the tenant. Examples: `prometheus`, `loki`, `victorialogs`, `sls`, `elasticsearch`, `mysql`, `postgres`, `oracle`, `clickhouse`." + }, + "ds_name": { + "type": "string", + "description": "Data source name; must match a configured data source under the tenant." + }, + "expr": { + "type": "string", + "description": "Query expression. Syntax depends on `ds_type` and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.)." + }, + "delay_seconds": { + "type": "integer", + "description": "Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.", + "default": 0 + }, + "args": { + "type": "object", + "description": "Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings, and keys are always namespaced by source (e.g. `sls.project`, `loki.type`). Validation depends on `ds_type`: SLS requires `sls.project` + `sls.logstore`. Elasticsearch accepts `es.type` of `sql`, or omitted — any other value is rejected. Loki and VictoriaLogs accept `.type` of `stats`, `raw`, or omitted; `raw` additionally requires a time range, either `.start` + `.end` or `.timespan.value` + `.timespan.unit` (unit one of `s`, `m`, `h`, `d`). Prometheus and the remaining SQL sources ignore `args` entirely.", + "additionalProperties": { + "type": "string" + } } - ] + }, + "description": "Request for the stable structured query endpoint." }, "QueryDataResponse": { "type": "object", @@ -6419,72 +6195,6 @@ } } }, - "QueryRowsRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "properties": { - "account_id": { - "type": "integer", - "format": "int64", - "description": "Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account." - }, - "ds_type": { - "type": "string", - "description": "Data source type; must match a configured data source under the tenant. Examples: `prometheus`, `loki`, `victorialogs`, `sls`, `elasticsearch`, `mysql`, `postgres`, `oracle`, `clickhouse`." - }, - "ds_name": { - "type": "string", - "description": "Data source name; must match a configured data source under the tenant." - }, - "expr": { - "type": "string", - "description": "Query expression. Syntax depends on `ds_type` and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.)." - }, - "delay_seconds": { - "type": "integer", - "description": "Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.", - "default": 0 - }, - "args": { - "type": "object", - "description": "Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings, and keys are always namespaced by source (e.g. `sls.project`, `loki.type`). Validation depends on `ds_type`: SLS requires `sls.project` + `sls.logstore`. Elasticsearch accepts `es.type` of `sql`, or omitted — any other value is rejected. Loki and VictoriaLogs accept `.type` of `stats`, `raw`, or omitted; `raw` additionally requires a time range, either `.start` + `.end` or `.timespan.value` + `.timespan.unit` (unit one of `s`, `m`, `h`, `d`). Prometheus and the remaining SQL sources ignore `args` entirely.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "QueryRowsResponse": { - "type": "array", - "description": "Result rows. Different data sources populate `fields` vs `values` differently — metric sources (Prometheus, *-stats) put numbers into `values`; detail sources (SQL, SLS, raw logs) put data into `fields` and may return `values: null`.", - "items": { - "$ref": "#/components/schemas/QueryRow" - } - }, - "QueryRow": { - "type": "object", - "properties": { - "fields": { - "type": "object", - "description": "String-valued fields (labels, log fields, SQL columns).", - "additionalProperties": { - "type": "string" - } - }, - "values": { - "type": "object", - "nullable": true, - "description": "Numeric fields. For metric queries the canonical key is `__value__`. May be `null` for detail-oriented sources.", - "additionalProperties": { - "type": "number" - } - } - } - }, "DiagnoseRequest": { "type": "object", "required": [ @@ -6939,44 +6649,6 @@ } } }, - "PreviewSyncRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "description": "Parameters for a synchronous datasource query preview.", - "properties": { - "ds_type": { - "type": "string", - "description": "Datasource type, e.g. `prometheus`, `loki`, `elasticsearch`." - }, - "ds_name": { - "type": "string", - "description": "Datasource display name as configured in the account." - }, - "expr": { - "type": "string", - "description": "Query expression. Format depends on `ds_type` (PromQL for Prometheus, LogQL for Loki, etc.)." - }, - "delay_seconds": { - "type": "integer", - "description": "Shift the query window backward by this many seconds to compensate for data ingestion latency." - }, - "args": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Additional datasource-type-specific query arguments (string keys and values), e.g. `sls.project` and `sls.logstore` for SLS, `es.type` for Elasticsearch, `loki.type` and `loki.limit` for Loki." - } - } - }, - "PreviewSyncResponse": { - "type": "object", - "description": "Raw JSON response from the datasource. Schema varies by datasource type." - }, "DiagnoseEvidenceWindow": { "type": "object", "description": "Current analysis window using RFC 3339 UTC timestamps.", diff --git a/api-reference/monitors.openapi.zh.json b/api-reference/monitors.openapi.zh.json index 796da38..816b9c7 100644 --- a/api-reference/monitors.openapi.zh.json +++ b/api-reference/monitors.openapi.zh.json @@ -33,10 +33,6 @@ "name": "Monitors/诊断分析", "description": "Flashduty AI SRE 使用的诊断与查询接口——数据源即席查询、日志/指标诊断,以及监控对象侧的工具调用。" }, - { - "name": "Monitors/通用工具", - "description": "监控服务开通及数据预览工具。" - }, { "name": "Monitors/服务拓扑", "description": "查询基于网络观测生成的服务拓扑、依赖摘要,以及主机的服务拓扑采集状态。" @@ -817,83 +813,6 @@ } } }, - "/monit/rule/status": { - "post": { - "operationId": "monit-rule-write-status", - "summary": "查看文件夹下规则触发状态", - "description": "返回指定文件夹节点及其子孙节点下所有规则的触发情况汇总。", - "tags": [ - "Monitors/告警规则" - ], - "x-mint": { - "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**;**50 次/秒** |\n| 权限要求 | **告警规则管理**(`monit`) |\n\n## 使用说明\n\n- 将 `folder_id` 设为 `0` 可获取所有文件夹的汇总。\n- 若文件夹包含规则数量过多,为保护系统会跳过计算。", - "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-status", - "metadata": { - "sidebarTitle": "查看文件夹下规则触发状态" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/RuleStatusResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "folder_id": 100, - "folder_name": "生产环境", - "rule_total": 10, - "triggered_rule_count": 2 - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleFolderIDRequest" - }, - "example": { - "folder_id": 100 - } - } - } - } - } - }, "/monit/rule/export": { "post": { "operationId": "monit-rule-read-export", @@ -2449,7 +2368,7 @@ "Monitors/诊断分析" ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n| Edge 版本要求 | 受支持的部署要求 **monit-edge v0.65.0 或更高版本** |\n\n## 使用说明\n\n- 此公开接口以 **monit-edge v0.65.0** 为最低受支持版本。迁移期间,WebAPI 仍保留旧版 Edge 适配器:query.v2 结果仍可能保留 frames、records 或 samples,而 legacy rows 只能提供其已保留的信息。这些适配器不会改变最低支持版本;旧协议缺少 query.v3 的取消和错误生命周期语义,legacy rows 已丢失的数据也无法恢复。\n- 公开响应格式固定为 `query_result.v1`,与 Edge 内部查询协议版本无关。必须根据 `result.kind`(`frames`、`records` 或 `samples`)分发结果,不要根据 `ds_type` 或 Edge 版本猜测结果形态。\n- `frames` 结果可以包含多个表格或时序 Frame。字段值按列组织,同一 Frame 中所有字段的值数量一致。\n- `records` 结果可以包含嵌套 JSON 和 null record。超出 JavaScript 安全整数范围的整数字面量会以十进制字符串返回。\n- `samples` 结果包含标签集合和瞬时值。值可以是数字,也可以是字符串 `NaN`、`+Inf` 或 `-Inf`。\n- 最终成功响应上限为 8 MiB,查询结果上限为 1,000 行。超限时请缩短时间范围、减少字段或在数据源侧聚合。\n- 查询失败使用非 2xx HTTP 状态码和标准错误 envelope。不要透明回退到已弃用的 `/monit/query/rows` 接口。\n- WebAPI 跨实例转发和 Edge 执行合计可能耗时 35 秒。客户端超时建议至少设为 40 秒,并在调用方放弃查询时向下传播取消信号。", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n| Edge 版本要求 | 受支持的部署要求 **monit-edge v0.65.0 或更高版本** |\n\n## 使用说明\n\n- 此公开接口以 **monit-edge v0.65.0** 为最低受支持版本。迁移期间,WebAPI 仍保留旧版 Edge 适配器:query.v2 结果仍可能保留 frames、records 或 samples,而 legacy rows 只能提供其已保留的信息。这些适配器不会改变最低支持版本;旧协议缺少 query.v3 的取消和错误生命周期语义,legacy rows 已丢失的数据也无法恢复。\n- 公开响应格式固定为 `query_result.v1`,与 Edge 内部查询协议版本无关。必须根据 `result.kind`(`frames`、`records` 或 `samples`)分发结果,不要根据 `ds_type` 或 Edge 版本猜测结果形态。\n- `frames` 结果可以包含多个表格或时序 Frame。字段值按列组织,同一 Frame 中所有字段的值数量一致。\n- `records` 结果可以包含嵌套 JSON 和 null record。超出 JavaScript 安全整数范围的整数字面量会以十进制字符串返回。\n- `samples` 结果包含标签集合和瞬时值。值可以是数字,也可以是字符串 `NaN`、`+Inf` 或 `-Inf`。\n- 最终成功响应上限为 8 MiB,查询结果上限为 1,000 行。超限时请缩短时间范围、减少字段或在数据源侧聚合。\n- 查询失败使用非 2xx HTTP 状态码和标准错误 envelope。旧版 `/monit/query/rows` 接口已下线;数据源查询请使用此接口。\n- WebAPI 跨实例转发和 Edge 执行合计可能耗时 35 秒。客户端超时建议至少设为 40 秒,并在调用方放弃查询时向下传播取消信号。", "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-data", "metadata": { "sidebarTitle": "查询结构化数据" @@ -2563,92 +2482,6 @@ } } }, - "/monit/query/rows": { - "post": { - "operationId": "monit-read-query-rows", - "summary": "查询数据源原始行", - "description": "已弃用。执行同步即席查询并返回历史扁平 rows 结构。现有调用方应迁移到 `/monit/query/data`;新接口会保留 frames、records 和 samples 的自然语义,不再把所有结果强制压成 legacy rows。", - "deprecated": true, - "tags": [ - "Monitors/诊断分析" - ], - "x-mint": { - "content": "## 已弃用\n\n所有新集成请使用 [`POST /monit/query/data`](/zh/api-reference/monitors/diagnostics/monit-read-query-data)。本接口仅在现有前端和 AI SRE 调用方迁移期间保留。\n\n## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n\n## 使用说明\n\n- 请求通过 WebSocket 转发至 `monit-edge`;`ds_type` + `ds_name` 指定的数据源必须已存在于调用账户下。\n- 请求体中的 `account_id` 可选。若传入,必须与认证账户一致;不一致将被拒绝。\n- 参数校验失败使用标准错误 envelope。当 `monit-edge` 拒绝查询时,其 `{\"error\": {\"code\": ..., \"message\": ...}}` 响应体会被保留,HTTP 状态码与 Edge 错误码一致;错误码无效或缺失时返回 HTTP 500。请同时检查状态码和错误响应体。\n- monit-edge 强制行数上限;结果过多时返回 `error.message = \"too many rows\"`。请缩小时间范围或在数据源侧聚合。\n- `args` 是透传的多态 `string→string` 映射,语义取决于 `ds_type`(SLS 需要 `sls.project` + `sls.logstore`;Loki/VictoriaLogs 原始模式需要通过 `*.start`/`*.end` 或 `*.timespan.value`/`*.timespan.unit` 指定时间范围;Prometheus 和 SQL 数据源忽略该字段)。各数据源完整参数列表见 monit-webapi query-api 文档。", - "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-rows", - "metadata": { - "sidebarTitle": "查询数据源原始行" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRowsRequest" - }, - "example": { - "account_id": 10001, - "ds_type": "prometheus", - "ds_name": "prod-prom", - "expr": "up", - "delay_seconds": 30 - } - } - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/QueryRowsResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "fields": { - "__name__": "up", - "instance": "10.0.0.1:9100", - "job": "node" - }, - "values": { - "__value__": 1 - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - } - } - }, "/monit/query/diagnose": { "post": { "operationId": "monit-read-query-diagnose", @@ -2658,7 +2491,7 @@ "Monitors/诊断分析" ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是诊断 / RCA 接口,而非原始数据查询接口——如需查看明细行,请配合 `/monit/query/rows` 使用。\n- 仅支持三种 `ds_type` 与 `operation` 组合:`loki` / `victorialogs` → `log_patterns`,`prometheus` → `metric_trends`。即使显式传入 `operation`,其他数据源也会被拒绝。\n- `methods` 选择要执行的分析方法;省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。\n- `time_range` 单位为 Unix 秒;缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。\n- 请求通过 WebSocket 转发至 `monit-edge`。长耗时:边缘侧执行可能耗时约 30 秒,叠加 webapi 开销。客户端超时应至少设置为 **35 秒**。\n- `options.*` 由边缘侧设置上限(`max_logs_scanned` ≤ 50 000,`max_patterns` ≤ 50,`examples_per_pattern` ≤ 3,`step_seconds` ∈ [15, 300],`max_series` ≤ 200,`topk` ≤ 50,`timeout_seconds` ≤ 30)。\n- 与 `/monit/query/rows` 一样存在两层错误:边缘侧执行错误以 HTTP 200 返回,响应体中带 `error` 对象——务必同时检查两层。\n- 日志样例在返回前会经过基础脱敏处理,响应中会带 `warnings: [\"examples redacted\"]`。不可作为原始日志使用。", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是诊断 / RCA 接口,而非原始数据查询接口——如需查看明细行,请配合 `/monit/query/data` 使用。\n- 仅支持三种 `ds_type` 与 `operation` 组合:`loki` / `victorialogs` → `log_patterns`,`prometheus` → `metric_trends`。即使显式传入 `operation`,其他数据源也会被拒绝。\n- `methods` 选择要执行的分析方法;省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。\n- `time_range` 单位为 Unix 秒;缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。\n- 请求通过 WebSocket 转发至 `monit-edge`。长耗时:边缘侧执行可能耗时约 30 秒,叠加 webapi 开销。客户端超时应至少设置为 **35 秒**。\n- `options.*` 由边缘侧设置上限(`max_logs_scanned` ≤ 50 000,`max_patterns` ≤ 50,`examples_per_pattern` ≤ 3,`step_seconds` ∈ [15, 300],`max_series` ≤ 200,`topk` ≤ 50,`timeout_seconds` ≤ 30)。\n- 此接口存在两层错误:边缘侧执行错误以 HTTP 200 返回,响应体中带 `error` 对象——务必同时检查两层。\n- 日志样例在返回前会经过基础脱敏处理,响应中会带 `warnings: [\"examples redacted\"]`。不可作为原始日志使用。", "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-diagnose", "metadata": { "sidebarTitle": "数据源诊断" @@ -3150,85 +2983,6 @@ } } }, - "/monit/preview/sync": { - "post": { - "operationId": "monit-preview-sync", - "summary": "同步预览数据源查询", - "description": "同步执行数据源查询并返回原始结果,用于在保存前预览告警规则表达式的效果。", - "tags": [ - "Monitors/通用工具" - ], - "x-mint": { - "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **60 次/分钟**;**10 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- `ds_type` 须与数据源类型匹配,如 `prometheus`、`loki`。\n- `ds_name` 为账户中配置的数据源显示名称。\n- `delay_seconds` 将查询窗口向前偏移指定秒数,用于补偿数据摄入延迟。\n- 响应体为数据源返回的原始 JSON,其结构随数据源类型而异。", - "href": "/zh/api-reference/monitors/monitor-utilities/monit-preview-sync", - "metadata": { - "sidebarTitle": "同步预览数据源查询" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PreviewSyncResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "status": "success", - "data": { - "resultType": "vector", - "result": [] - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PreviewSyncRequest" - }, - "example": { - "ds_type": "prometheus", - "ds_name": "生产 Prometheus", - "expr": "rate(http_requests_total[5m])", - "delay_seconds": 0 - } - } - } - } - } - }, "/monit/servicemap/status": { "post": { "operationId": "monit-servicemap-read-status", @@ -5845,16 +5599,6 @@ } } }, - "RuleFolderIDRequest": { - "type": "object", - "properties": { - "folder_id": { - "type": "integer", - "format": "uint64", - "description": "要统计的文件夹 ID,可通过 `POST /monit/folder/list` 获取。服务端按直属子文件夹分组返回规则触发统计。" - } - } - }, "RuleIDRequest": { "type": "object", "required": [ @@ -6188,12 +5932,44 @@ ] }, "QueryDataRequest": { - "description": "稳定结构化查询接口的请求。字段与已弃用的 rows 接口一致。", - "allOf": [ - { - "$ref": "#/components/schemas/QueryRowsRequest" + "type": "object", + "required": [ + "ds_type", + "ds_name", + "expr" + ], + "properties": { + "account_id": { + "type": "integer", + "format": "int64", + "description": "可选的一致性校验。若提供,必须等于已认证账户;不一致将被拒绝。业务执行始终使用已认证账户。" + }, + "ds_type": { + "type": "string", + "description": "数据源类型;必须匹配租户下已配置的数据源。示例:`prometheus`、`loki`、`victorialogs`、`sls`、`elasticsearch`、`mysql`、`postgres`、`oracle`、`clickhouse`。" + }, + "ds_name": { + "type": "string", + "description": "数据源名称;必须匹配租户下已配置的数据源。" + }, + "expr": { + "type": "string", + "description": "查询表达式。语法取决于 `ds_type`,由对应的 monit-edge 客户端解释(Prometheus 用 PromQL,Loki 用 LogQL,SQL 类数据源用 SQL,等等)。" + }, + "delay_seconds": { + "type": "integer", + "description": "应用于点查询(Prometheus、Loki stats、VictoriaLogs stats)的回看偏移,单位秒。明细 / raw 查询忽略该字段。", + "default": 0 + }, + "args": { + "type": "object", + "description": "透传给 monit-edge 的多态键值扩展参数。所有值必须是字符串,键一律按数据源加前缀(如 `sls.project`、`loki.type`)。校验规则取决于 `ds_type`:SLS 必须提供 `sls.project` 与 `sls.logstore`;Elasticsearch 的 `es.type` 只接受 `sql` 或不传,其他值一律拒绝;Loki 与 VictoriaLogs 的 `.type` 接受 `stats`、`raw` 或不传,其中 `raw` 还必须给出时间范围——`.start` + `.end`,或 `.timespan.value` + `.timespan.unit`(单位取 `s`/`m`/`h`/`d`)。Prometheus 及其余 SQL 类数据源完全忽略 `args`。", + "additionalProperties": { + "type": "string" + } } - ] + }, + "description": "稳定结构化查询接口的请求参数。" }, "QueryDataResponse": { "type": "object", @@ -6419,72 +6195,6 @@ } } }, - "QueryRowsRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "properties": { - "account_id": { - "type": "integer", - "format": "int64", - "description": "可选的一致性校验。若提供,必须等于已认证账户;不一致将被拒绝。业务执行始终使用已认证账户。" - }, - "ds_type": { - "type": "string", - "description": "数据源类型;必须匹配租户下已配置的数据源。示例:`prometheus`、`loki`、`victorialogs`、`sls`、`elasticsearch`、`mysql`、`postgres`、`oracle`、`clickhouse`。" - }, - "ds_name": { - "type": "string", - "description": "数据源名称;必须匹配租户下已配置的数据源。" - }, - "expr": { - "type": "string", - "description": "查询表达式。语法取决于 `ds_type`,由对应的 monit-edge 客户端解释(Prometheus 用 PromQL,Loki 用 LogQL,SQL 类数据源用 SQL,等等)。" - }, - "delay_seconds": { - "type": "integer", - "description": "应用于点查询(Prometheus、Loki stats、VictoriaLogs stats)的回看偏移,单位秒。明细 / raw 查询忽略该字段。", - "default": 0 - }, - "args": { - "type": "object", - "description": "透传给 monit-edge 的多态键值扩展参数。所有值必须是字符串,键一律按数据源加前缀(如 `sls.project`、`loki.type`)。校验规则取决于 `ds_type`:SLS 必须提供 `sls.project` 与 `sls.logstore`;Elasticsearch 的 `es.type` 只接受 `sql` 或不传,其他值一律拒绝;Loki 与 VictoriaLogs 的 `.type` 接受 `stats`、`raw` 或不传,其中 `raw` 还必须给出时间范围——`.start` + `.end`,或 `.timespan.value` + `.timespan.unit`(单位取 `s`/`m`/`h`/`d`)。Prometheus 及其余 SQL 类数据源完全忽略 `args`。", - "additionalProperties": { - "type": "string" - } - } - } - }, - "QueryRowsResponse": { - "type": "array", - "description": "结果行。不同数据源对 `fields` 与 `values` 的填充方式不同——指标类数据源(Prometheus、*-stats)将数字放入 `values`;明细类数据源(SQL、SLS、原始日志)将数据放入 `fields`,`values` 可能为 `null`。", - "items": { - "$ref": "#/components/schemas/QueryRow" - } - }, - "QueryRow": { - "type": "object", - "properties": { - "fields": { - "type": "object", - "description": "字符串值字段(标签、日志字段、SQL 列)。", - "additionalProperties": { - "type": "string" - } - }, - "values": { - "type": "object", - "nullable": true, - "description": "数值字段。对于指标查询,规范键名为 `__value__`。对于明细类数据源可能为 `null`。", - "additionalProperties": { - "type": "number" - } - } - } - }, "DiagnoseRequest": { "type": "object", "required": [ @@ -6939,44 +6649,6 @@ } } }, - "PreviewSyncRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "description": "同步数据源查询预览的参数。", - "properties": { - "ds_type": { - "type": "string", - "description": "数据源类型,如 `prometheus`、`loki`、`elasticsearch`。" - }, - "ds_name": { - "type": "string", - "description": "账户中配置的数据源显示名称。" - }, - "expr": { - "type": "string", - "description": "查询表达式,格式因 `ds_type` 而异(Prometheus 为 PromQL,Loki 为 LogQL 等)。" - }, - "delay_seconds": { - "type": "integer", - "description": "将查询窗口向前偏移的秒数,用于补偿数据摄入延迟。" - }, - "args": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "特定数据源类型的附加查询参数(键值均为字符串),如 SLS 的 `sls.project`、`sls.logstore`,Elasticsearch 的 `es.type`,Loki 的 `loki.type`、`loki.limit`。" - } - } - }, - "PreviewSyncResponse": { - "type": "object", - "description": "数据源返回的原始 JSON,结构随数据源类型而异。" - }, "DiagnoseEvidenceWindow": { "type": "object", "description": "分析的当前时间窗口,使用 RFC 3339 UTC 时间戳。", diff --git a/api-reference/openapi.en.json b/api-reference/openapi.en.json index 9e4a04d..1d3364d 100644 --- a/api-reference/openapi.en.json +++ b/api-reference/openapi.en.json @@ -121,10 +121,6 @@ "name": "AI SRE/Sessions", "description": "AI SRE agent session history — list, inspect, and export transcripts." }, - { - "name": "Monitors/Monitor utilities", - "description": "Monitors service activation and data preview utilities." - }, { "name": "AI SRE/Automations" }, @@ -14138,83 +14134,6 @@ } } }, - "/monit/rule/status": { - "post": { - "operationId": "monit-rule-write-status", - "summary": "Get rule trigger status under folder", - "description": "Return the rule trigger summary for all rules under a folder node and its descendants.", - "tags": [ - "Monitors/Alert rules" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | **Alerting Rules Manage** (`monit`) |\n\n## Usage\n\n- Set `folder_id` to `0` to get summary across all folders.\n- If the folder contains too many rules, computation is skipped for self-protection.", - "href": "/en/api-reference/monitors/alert-rules/monit-rule-write-status", - "metadata": { - "sidebarTitle": "Get rule trigger status under folder" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/RuleStatusResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "folder_id": 100, - "folder_name": "Production", - "rule_total": 10, - "triggered_rule_count": 2 - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleFolderIDRequest" - }, - "example": { - "folder_id": 100 - } - } - } - } - } - }, "/monit/rule/audits": { "post": { "operationId": "monit-rule-read-audits", @@ -19986,7 +19905,7 @@ "Monitors/Diagnostics" ], "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n| Edge requirement | Supported deployments require **monit-edge v0.65.0 or later** |\n\n## Usage\n\n- Treat **monit-edge v0.65.0** as the minimum supported Edge version for this public API. WebAPI retains migration adapters for older Edge versions: query.v2 results may still preserve frames, records, or samples, while legacy rows can expose only the information they retained. These adapters do not change the support floor; older protocols lack query.v3 cancellation and error-lifecycle semantics, and data already lost by legacy rows cannot be recovered.\n- The public response format is always `query_result.v1` and is independent of the internal Edge query protocol. Dispatch on `result.kind` (`frames`, `records`, or `samples`); do not infer the result shape from `ds_type` or the Edge version.\n- A `frames` result may contain multiple table or time-series frames. Field values are columnar and all fields in one frame have the same length.\n- A `records` result may contain nested JSON and null records. Integer literals outside JavaScript's safe integer range are returned as decimal strings.\n- A `samples` result contains label sets and instant values. A value may be a number or one of the strings `NaN`, `+Inf`, and `-Inf`.\n- The final success response is limited to 8 MiB and query results are limited to 1,000 rows. Narrow the time range, reduce fields, or aggregate at the source when a request exceeds a limit.\n- Query failures use non-2xx HTTP status codes and the standard error envelope. Do not transparently fall back to the deprecated `/monit/query/rows` endpoint.\n- Query execution may take up to 35 seconds across WebAPI forwarding and Edge execution. Configure client timeouts to at least 40 seconds and propagate cancellation when the caller abandons a query.", + "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n| Edge requirement | Supported deployments require **monit-edge v0.65.0 or later** |\n\n## Usage\n\n- Treat **monit-edge v0.65.0** as the minimum supported Edge version for this public API. WebAPI retains migration adapters for older Edge versions: query.v2 results may still preserve frames, records, or samples, while legacy rows can expose only the information they retained. These adapters do not change the support floor; older protocols lack query.v3 cancellation and error-lifecycle semantics, and data already lost by legacy rows cannot be recovered.\n- The public response format is always `query_result.v1` and is independent of the internal Edge query protocol. Dispatch on `result.kind` (`frames`, `records`, or `samples`); do not infer the result shape from `ds_type` or the Edge version.\n- A `frames` result may contain multiple table or time-series frames. Field values are columnar and all fields in one frame have the same length.\n- A `records` result may contain nested JSON and null records. Integer literals outside JavaScript's safe integer range are returned as decimal strings.\n- A `samples` result contains label sets and instant values. A value may be a number or one of the strings `NaN`, `+Inf`, and `-Inf`.\n- The final success response is limited to 8 MiB and query results are limited to 1,000 rows. Narrow the time range, reduce fields, or aggregate at the source when a request exceeds a limit.\n- Query failures use non-2xx HTTP status codes and the standard error envelope. The legacy `/monit/query/rows` endpoint has been removed; use this endpoint for datasource queries.\n- Query execution may take up to 35 seconds across WebAPI forwarding and Edge execution. Configure client timeouts to at least 40 seconds and propagate cancellation when the caller abandons a query.", "href": "/en/api-reference/monitors/diagnostics/monit-read-query-data", "metadata": { "sidebarTitle": "Query structured data" @@ -20100,92 +20019,6 @@ } } }, - "/monit/query/rows": { - "post": { - "operationId": "monit-read-query-rows", - "summary": "Query data source rows", - "description": "Deprecated. Run a synchronous ad-hoc query and return the historical flattened rows shape. Existing consumers should migrate to `/monit/query/data`, which preserves frames, records, and samples without forcing every result into legacy rows.", - "deprecated": true, - "tags": [ - "Monitors/Diagnostics" - ], - "x-mint": { - "content": "## Deprecated\n\nUse [`POST /monit/query/data`](/en/api-reference/monitors/diagnostics/monit-read-query-data) for all new integrations. This endpoint remains available only during the migration of existing UI and AI SRE consumers.\n\n## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **100 requests/minute**; **5 requests/second** per account |\n| Permissions | Any valid `app_key` (read-only; not gated by a specific permission class) |\n\n## Usage\n\n- The request is forwarded to `monit-edge` over WebSocket; the data source named by `ds_type` + `ds_name` must already exist under the calling account.\n- `account_id` in the body is optional. When supplied it must equal the authenticated account; mismatched values are rejected.\n- Validation failures use the standard error envelope. When `monit-edge` rejects a query, its `{\"error\": {\"code\": ..., \"message\": ...}}` body is preserved and the HTTP status matches the edge error code; an invalid or absent code becomes HTTP 500. Check both the status and the error body.\n- monit-edge enforces a row cap; large result sets come back as `error.message = \"too many rows\"`. Narrow the time range or aggregate at the source.\n- `args` is a polymorphic `string→string` map that is forwarded verbatim. Semantics depend on `ds_type` (SLS requires `sls.project` + `sls.logstore`; Loki / VictoriaLogs raw mode requires a time range via `*.start`/`*.end` or `*.timespan.value`/`*.timespan.unit`; Prometheus and SQL sources ignore it). See the monit-webapi query-api docs for the per-source key list.", - "href": "/en/api-reference/monitors/diagnostics/monit-read-query-rows", - "metadata": { - "sidebarTitle": "Query data source rows" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRowsRequest" - }, - "example": { - "account_id": 10001, - "ds_type": "prometheus", - "ds_name": "prod-prom", - "expr": "up", - "delay_seconds": 30 - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/QueryRowsResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "fields": { - "__name__": "up", - "instance": "10.0.0.1:9100", - "job": "node" - }, - "values": { - "__value__": 1 - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - } - } - }, "/monit/query/diagnose": { "post": { "operationId": "monit-read-query-diagnose", @@ -20195,7 +20028,7 @@ "Monitors/Diagnostics" ], "x-mint": { - "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- This is a diagnostic / RCA endpoint, not a raw data query — pair it with `/monit/query/rows` when you need detailed rows.\n- Only three `ds_type` and `operation` pairs are supported: `loki` / `victorialogs` → `log_patterns`, and `prometheus` → `metric_trends`. Every other datasource is rejected, even when `operation` is explicit.\n- `methods` selects the analyses to run; when omitted, `log_patterns` defaults to `pattern_snapshot + pattern_compare(previous_window)` and `metric_trends` defaults to `single_window_shape + window_compare(previous_window)`.\n- `time_range` is in Unix seconds; missing or invalid values default to the last 15 minutes; a window wider than 6 hours is rejected.\n- The request is forwarded over WebSocket to `monit-edge`. Long-running: the request may take up to ~30 s on the edge side plus webapi overhead. Set client timeouts to **at least 35 s**.\n- `options.*` are upper-bounded by edge (`max_logs_scanned` ≤ 50 000, `max_patterns` ≤ 50, `examples_per_pattern` ≤ 3, `step_seconds` ∈ [15, 300], `max_series` ≤ 200, `topk` ≤ 50, `timeout_seconds` ≤ 30).\n- Two error layers as with `/monit/query/rows`: edge-level execution errors come back as HTTP 200 with an `error` object in the body — check both layers.\n- Log examples are basic-redacted before being returned; expect `warnings: [\"examples redacted\"]`. Do not treat them as raw logs.", + "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- This is a diagnostic / RCA endpoint, not a raw data query — pair it with `/monit/query/data` when you need detailed rows.\n- Only three `ds_type` and `operation` pairs are supported: `loki` / `victorialogs` → `log_patterns`, and `prometheus` → `metric_trends`. Every other datasource is rejected, even when `operation` is explicit.\n- `methods` selects the analyses to run; when omitted, `log_patterns` defaults to `pattern_snapshot + pattern_compare(previous_window)` and `metric_trends` defaults to `single_window_shape + window_compare(previous_window)`.\n- `time_range` is in Unix seconds; missing or invalid values default to the last 15 minutes; a window wider than 6 hours is rejected.\n- The request is forwarded over WebSocket to `monit-edge`. Long-running: the request may take up to ~30 s on the edge side plus webapi overhead. Set client timeouts to **at least 35 s**.\n- `options.*` are upper-bounded by edge (`max_logs_scanned` ≤ 50 000, `max_patterns` ≤ 50, `examples_per_pattern` ≤ 3, `step_seconds` ∈ [15, 300], `max_series` ≤ 200, `topk` ≤ 50, `timeout_seconds` ≤ 30).\n- Two error layers exist: edge-level execution errors come back as HTTP 200 with an `error` object in the body — check both layers.\n- Log examples are basic-redacted before being returned; expect `warnings: [\"examples redacted\"]`. Do not treat them as raw logs.", "href": "/en/api-reference/monitors/diagnostics/monit-read-query-diagnose", "metadata": { "sidebarTitle": "Diagnose data source" @@ -22275,85 +22108,6 @@ ] } }, - "/monit/preview/sync": { - "post": { - "operationId": "monit-preview-sync", - "summary": "Preview datasource query", - "description": "Execute a synchronous datasource query and return the raw result. Used to preview alert rule expressions before saving.", - "tags": [ - "Monitors/Monitor utilities" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **60 requests/minute**; **10 requests/second** per account |\n| Permissions | None — any valid `app_key` can call this operation |\n\n## Usage\n\n- `ds_type` must match the datasource type (e.g. `prometheus`, `loki`).\n- `ds_name` is the display name of the datasource as configured in the account.\n- `delay_seconds` shifts the query window backward by the specified number of seconds, useful for accommodating data ingestion latency.\n- The response body is the raw JSON returned by the datasource — its schema varies by datasource type.", - "href": "/en/api-reference/monitors/monitor-utilities/monit-preview-sync", - "metadata": { - "sidebarTitle": "Preview datasource query" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PreviewSyncResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "status": "success", - "data": { - "resultType": "vector", - "result": [] - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PreviewSyncRequest" - }, - "example": { - "ds_type": "prometheus", - "ds_name": "Prometheus Prod", - "expr": "rate(http_requests_total[5m])", - "delay_seconds": 0 - } - } - } - } - } - }, "/status-page/info": { "get": { "operationId": "statusPageInfo", @@ -43714,16 +43468,6 @@ "description": "Empty response on success.", "additionalProperties": false }, - "RuleFolderIDRequest": { - "type": "object", - "properties": { - "folder_id": { - "type": "integer", - "format": "uint64", - "description": "Folder ID to summarize. Obtainable via `POST /monit/folder/list`. Trigger statistics are returned grouped by direct child folder." - } - } - }, "RuleFieldsUpdateRequest": { "type": "object", "required": [ @@ -48145,12 +47889,44 @@ } }, "QueryDataRequest": { - "description": "Request for the stable structured query endpoint. It uses the same query fields as the deprecated rows endpoint.", - "allOf": [ - { - "$ref": "#/components/schemas/QueryRowsRequest" + "type": "object", + "required": [ + "ds_type", + "ds_name", + "expr" + ], + "properties": { + "account_id": { + "type": "integer", + "format": "int64", + "description": "Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account." + }, + "ds_type": { + "type": "string", + "description": "Data source type; must match a configured data source under the tenant. Examples: `prometheus`, `loki`, `victorialogs`, `sls`, `elasticsearch`, `mysql`, `postgres`, `oracle`, `clickhouse`." + }, + "ds_name": { + "type": "string", + "description": "Data source name; must match a configured data source under the tenant." + }, + "expr": { + "type": "string", + "description": "Query expression. Syntax depends on `ds_type` and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.)." + }, + "delay_seconds": { + "type": "integer", + "description": "Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.", + "default": 0 + }, + "args": { + "type": "object", + "description": "Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings, and keys are always namespaced by source (e.g. `sls.project`, `loki.type`). Validation depends on `ds_type`: SLS requires `sls.project` + `sls.logstore`. Elasticsearch accepts `es.type` of `sql`, or omitted — any other value is rejected. Loki and VictoriaLogs accept `.type` of `stats`, `raw`, or omitted; `raw` additionally requires a time range, either `.start` + `.end` or `.timespan.value` + `.timespan.unit` (unit one of `s`, `m`, `h`, `d`). Prometheus and the remaining SQL sources ignore `args` entirely.", + "additionalProperties": { + "type": "string" + } } - ] + }, + "description": "Request for the stable structured query endpoint." }, "QueryDataResponse": { "type": "object", @@ -48376,72 +48152,6 @@ } } }, - "QueryRowsRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "properties": { - "account_id": { - "type": "integer", - "format": "int64", - "description": "Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account." - }, - "ds_type": { - "type": "string", - "description": "Data source type; must match a configured data source under the tenant. Examples: `prometheus`, `loki`, `victorialogs`, `sls`, `elasticsearch`, `mysql`, `postgres`, `oracle`, `clickhouse`." - }, - "ds_name": { - "type": "string", - "description": "Data source name; must match a configured data source under the tenant." - }, - "expr": { - "type": "string", - "description": "Query expression. Syntax depends on `ds_type` and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.)." - }, - "delay_seconds": { - "type": "integer", - "description": "Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.", - "default": 0 - }, - "args": { - "type": "object", - "description": "Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings, and keys are always namespaced by source (e.g. `sls.project`, `loki.type`). Validation depends on `ds_type`: SLS requires `sls.project` + `sls.logstore`. Elasticsearch accepts `es.type` of `sql`, or omitted — any other value is rejected. Loki and VictoriaLogs accept `.type` of `stats`, `raw`, or omitted; `raw` additionally requires a time range, either `.start` + `.end` or `.timespan.value` + `.timespan.unit` (unit one of `s`, `m`, `h`, `d`). Prometheus and the remaining SQL sources ignore `args` entirely.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "QueryRowsResponse": { - "type": "array", - "description": "Result rows. Different data sources populate `fields` vs `values` differently — metric sources (Prometheus, *-stats) put numbers into `values`; detail sources (SQL, SLS, raw logs) put data into `fields` and may return `values: null`.", - "items": { - "$ref": "#/components/schemas/QueryRow" - } - }, - "QueryRow": { - "type": "object", - "properties": { - "fields": { - "type": "object", - "description": "String-valued fields (labels, log fields, SQL columns).", - "additionalProperties": { - "type": "string" - } - }, - "values": { - "type": "object", - "nullable": true, - "description": "Numeric fields. For metric queries the canonical key is `__value__`. May be `null` for detail-oriented sources.", - "additionalProperties": { - "type": "number" - } - } - } - }, "DiagnoseRequest": { "type": "object", "required": [ @@ -49833,44 +49543,6 @@ } } }, - "PreviewSyncRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "description": "Parameters for a synchronous datasource query preview.", - "properties": { - "ds_type": { - "type": "string", - "description": "Datasource type, e.g. `prometheus`, `loki`, `elasticsearch`." - }, - "ds_name": { - "type": "string", - "description": "Datasource display name as configured in the account." - }, - "expr": { - "type": "string", - "description": "Query expression. Format depends on `ds_type` (PromQL for Prometheus, LogQL for Loki, etc.)." - }, - "delay_seconds": { - "type": "integer", - "description": "Shift the query window backward by this many seconds to compensate for data ingestion latency." - }, - "args": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Additional datasource-type-specific query arguments (string keys and values), e.g. `sls.project` and `sls.logstore` for SLS, `es.type` for Elasticsearch, `loki.type` and `loki.limit` for Loki." - } - } - }, - "PreviewSyncResponse": { - "type": "object", - "description": "Raw JSON response from the datasource. Schema varies by datasource type." - }, "ResetPostMortemBasicsRequest": { "type": "object", "description": "Basic incident facts to write back to a post-mortem report.", diff --git a/api-reference/openapi.legacy.zh.json b/api-reference/openapi.legacy.zh.json index 5cdacfc..aadcb1b 100644 --- a/api-reference/openapi.legacy.zh.json +++ b/api-reference/openapi.legacy.zh.json @@ -24573,56 +24573,6 @@ ] } }, - "/monit/rule/status": { - "post": { - "summary": "按分组节点直属子节点统计规则触发状态", - "deprecated": false, - "description": "以指定分组节点的每个直属子节点为维度,统计其家族(子树)下的规则总数与活跃告警规则数。子节点或规则数过多时会返回错误以自保。", - "tags": [ - "Monitors/告警规则/统计" - ], - "parameters": [ - { - "name": "Content-Type", - "in": "header", - "description": "固定值 application/json。", - "required": true, - "example": "application/json", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FolderIDRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "data 为每个直属子节点一条统计记录。", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AlertRuleStatusListResponse" - } - } - }, - "headers": {} - } - }, - "security": [ - { - "apikey-query-app_key": [] - } - ] - } - }, "/monit/rule/counter/total": { "post": { "summary": "规则数量历史快照", diff --git a/api-reference/openapi.zh.json b/api-reference/openapi.zh.json index 3b107d0..46bd9fc 100644 --- a/api-reference/openapi.zh.json +++ b/api-reference/openapi.zh.json @@ -121,10 +121,6 @@ "name": "AI SRE/会话", "description": "AI SRE 智能体会话历史 —— 查询、查看与导出会话记录。" }, - { - "name": "Monitors/通用工具", - "description": "监控服务开通及数据预览工具。" - }, { "name": "AI SRE/自动化" }, @@ -14130,83 +14126,6 @@ } } }, - "/monit/rule/status": { - "post": { - "operationId": "monit-rule-write-status", - "summary": "查看文件夹下规则触发状态", - "description": "返回指定文件夹节点及其子孙节点下所有规则的触发情况汇总。", - "tags": [ - "Monitors/告警规则" - ], - "x-mint": { - "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**;**50 次/秒** |\n| 权限要求 | **告警规则管理**(`monit`) |\n\n## 使用说明\n\n- 将 `folder_id` 设为 `0` 可获取所有文件夹的汇总。\n- 若文件夹包含规则数量过多,为保护系统会跳过计算。", - "href": "/zh/api-reference/monitors/alert-rules/monit-rule-write-status", - "metadata": { - "sidebarTitle": "查看文件夹下规则触发状态" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/RuleStatusResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "folder_id": 100, - "folder_name": "生产环境", - "rule_total": 10, - "triggered_rule_count": 2 - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleFolderIDRequest" - }, - "example": { - "folder_id": 100 - } - } - } - } - } - }, "/monit/rule/audits": { "post": { "operationId": "monit-rule-read-audits", @@ -19978,7 +19897,7 @@ "Monitors/诊断分析" ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n| Edge 版本要求 | 受支持的部署要求 **monit-edge v0.65.0 或更高版本** |\n\n## 使用说明\n\n- 此公开接口以 **monit-edge v0.65.0** 为最低受支持版本。迁移期间,WebAPI 仍保留旧版 Edge 适配器:query.v2 结果仍可能保留 frames、records 或 samples,而 legacy rows 只能提供其已保留的信息。这些适配器不会改变最低支持版本;旧协议缺少 query.v3 的取消和错误生命周期语义,legacy rows 已丢失的数据也无法恢复。\n- 公开响应格式固定为 `query_result.v1`,与 Edge 内部查询协议版本无关。必须根据 `result.kind`(`frames`、`records` 或 `samples`)分发结果,不要根据 `ds_type` 或 Edge 版本猜测结果形态。\n- `frames` 结果可以包含多个表格或时序 Frame。字段值按列组织,同一 Frame 中所有字段的值数量一致。\n- `records` 结果可以包含嵌套 JSON 和 null record。超出 JavaScript 安全整数范围的整数字面量会以十进制字符串返回。\n- `samples` 结果包含标签集合和瞬时值。值可以是数字,也可以是字符串 `NaN`、`+Inf` 或 `-Inf`。\n- 最终成功响应上限为 8 MiB,查询结果上限为 1,000 行。超限时请缩短时间范围、减少字段或在数据源侧聚合。\n- 查询失败使用非 2xx HTTP 状态码和标准错误 envelope。不要透明回退到已弃用的 `/monit/query/rows` 接口。\n- WebAPI 跨实例转发和 Edge 执行合计可能耗时 35 秒。客户端超时建议至少设为 40 秒,并在调用方放弃查询时向下传播取消信号。", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n| Edge 版本要求 | 受支持的部署要求 **monit-edge v0.65.0 或更高版本** |\n\n## 使用说明\n\n- 此公开接口以 **monit-edge v0.65.0** 为最低受支持版本。迁移期间,WebAPI 仍保留旧版 Edge 适配器:query.v2 结果仍可能保留 frames、records 或 samples,而 legacy rows 只能提供其已保留的信息。这些适配器不会改变最低支持版本;旧协议缺少 query.v3 的取消和错误生命周期语义,legacy rows 已丢失的数据也无法恢复。\n- 公开响应格式固定为 `query_result.v1`,与 Edge 内部查询协议版本无关。必须根据 `result.kind`(`frames`、`records` 或 `samples`)分发结果,不要根据 `ds_type` 或 Edge 版本猜测结果形态。\n- `frames` 结果可以包含多个表格或时序 Frame。字段值按列组织,同一 Frame 中所有字段的值数量一致。\n- `records` 结果可以包含嵌套 JSON 和 null record。超出 JavaScript 安全整数范围的整数字面量会以十进制字符串返回。\n- `samples` 结果包含标签集合和瞬时值。值可以是数字,也可以是字符串 `NaN`、`+Inf` 或 `-Inf`。\n- 最终成功响应上限为 8 MiB,查询结果上限为 1,000 行。超限时请缩短时间范围、减少字段或在数据源侧聚合。\n- 查询失败使用非 2xx HTTP 状态码和标准错误 envelope。旧版 `/monit/query/rows` 接口已下线;数据源查询请使用此接口。\n- WebAPI 跨实例转发和 Edge 执行合计可能耗时 35 秒。客户端超时建议至少设为 40 秒,并在调用方放弃查询时向下传播取消信号。", "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-data", "metadata": { "sidebarTitle": "查询结构化数据" @@ -20092,92 +20011,6 @@ } } }, - "/monit/query/rows": { - "post": { - "operationId": "monit-read-query-rows", - "summary": "查询数据源原始行", - "description": "已弃用。执行同步即席查询并返回历史扁平 rows 结构。现有调用方应迁移到 `/monit/query/data`;新接口会保留 frames、records 和 samples 的自然语义,不再把所有结果强制压成 legacy rows。", - "deprecated": true, - "tags": [ - "Monitors/诊断分析" - ], - "x-mint": { - "content": "## 已弃用\n\n所有新集成请使用 [`POST /monit/query/data`](/zh/api-reference/monitors/diagnostics/monit-read-query-data)。本接口仅在现有前端和 AI SRE 调用方迁移期间保留。\n\n## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | 每账户 **100 次/分钟**、**5 次/秒** |\n| 权限 | 任意有效的 `app_key`(只读,不受特定权限分类限制) |\n\n## 使用说明\n\n- 请求通过 WebSocket 转发至 `monit-edge`;`ds_type` + `ds_name` 指定的数据源必须已存在于调用账户下。\n- 请求体中的 `account_id` 可选。若传入,必须与认证账户一致;不一致将被拒绝。\n- 参数校验失败使用标准错误 envelope。当 `monit-edge` 拒绝查询时,其 `{\"error\": {\"code\": ..., \"message\": ...}}` 响应体会被保留,HTTP 状态码与 Edge 错误码一致;错误码无效或缺失时返回 HTTP 500。请同时检查状态码和错误响应体。\n- monit-edge 强制行数上限;结果过多时返回 `error.message = \"too many rows\"`。请缩小时间范围或在数据源侧聚合。\n- `args` 是透传的多态 `string→string` 映射,语义取决于 `ds_type`(SLS 需要 `sls.project` + `sls.logstore`;Loki/VictoriaLogs 原始模式需要通过 `*.start`/`*.end` 或 `*.timespan.value`/`*.timespan.unit` 指定时间范围;Prometheus 和 SQL 数据源忽略该字段)。各数据源完整参数列表见 monit-webapi query-api 文档。", - "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-rows", - "metadata": { - "sidebarTitle": "查询数据源原始行" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/QueryRowsRequest" - }, - "example": { - "account_id": 10001, - "ds_type": "prometheus", - "ds_name": "prod-prom", - "expr": "up", - "delay_seconds": 30 - } - } - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/QueryRowsResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": [ - { - "fields": { - "__name__": "up", - "instance": "10.0.0.1:9100", - "job": "node" - }, - "values": { - "__value__": 1 - } - } - ] - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - } - } - }, "/monit/query/diagnose": { "post": { "operationId": "monit-read-query-diagnose", @@ -20187,7 +20020,7 @@ "Monitors/诊断分析" ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是诊断 / RCA 接口,而非原始数据查询接口——如需查看明细行,请配合 `/monit/query/rows` 使用。\n- 仅支持三种 `ds_type` 与 `operation` 组合:`loki` / `victorialogs` → `log_patterns`,`prometheus` → `metric_trends`。即使显式传入 `operation`,其他数据源也会被拒绝。\n- `methods` 选择要执行的分析方法;省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。\n- `time_range` 单位为 Unix 秒;缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。\n- 请求通过 WebSocket 转发至 `monit-edge`。长耗时:边缘侧执行可能耗时约 30 秒,叠加 webapi 开销。客户端超时应至少设置为 **35 秒**。\n- `options.*` 由边缘侧设置上限(`max_logs_scanned` ≤ 50 000,`max_patterns` ≤ 50,`examples_per_pattern` ≤ 3,`step_seconds` ∈ [15, 300],`max_series` ≤ 200,`topk` ≤ 50,`timeout_seconds` ≤ 30)。\n- 与 `/monit/query/rows` 一样存在两层错误:边缘侧执行错误以 HTTP 200 返回,响应体中带 `error` 对象——务必同时检查两层。\n- 日志样例在返回前会经过基础脱敏处理,响应中会带 `warnings: [\"examples redacted\"]`。不可作为原始日志使用。", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **600 次/分钟**;**10 次/秒** 每账户 |\n| 权限 | 任意有效的 `app_key`(只读;不受特定权限分类约束) |\n\n## 使用说明\n\n- 这是诊断 / RCA 接口,而非原始数据查询接口——如需查看明细行,请配合 `/monit/query/data` 使用。\n- 仅支持三种 `ds_type` 与 `operation` 组合:`loki` / `victorialogs` → `log_patterns`,`prometheus` → `metric_trends`。即使显式传入 `operation`,其他数据源也会被拒绝。\n- `methods` 选择要执行的分析方法;省略时,`log_patterns` 默认为 `pattern_snapshot + pattern_compare(previous_window)`,`metric_trends` 默认为 `single_window_shape + window_compare(previous_window)`。\n- `time_range` 单位为 Unix 秒;缺失或无效时默认最近 15 分钟;窗口宽度超过 6 小时将被拒绝。\n- 请求通过 WebSocket 转发至 `monit-edge`。长耗时:边缘侧执行可能耗时约 30 秒,叠加 webapi 开销。客户端超时应至少设置为 **35 秒**。\n- `options.*` 由边缘侧设置上限(`max_logs_scanned` ≤ 50 000,`max_patterns` ≤ 50,`examples_per_pattern` ≤ 3,`step_seconds` ∈ [15, 300],`max_series` ≤ 200,`topk` ≤ 50,`timeout_seconds` ≤ 30)。\n- 此接口存在两层错误:边缘侧执行错误以 HTTP 200 返回,响应体中带 `error` 对象——务必同时检查两层。\n- 日志样例在返回前会经过基础脱敏处理,响应中会带 `warnings: [\"examples redacted\"]`。不可作为原始日志使用。", "href": "/zh/api-reference/monitors/diagnostics/monit-read-query-diagnose", "metadata": { "sidebarTitle": "数据源诊断" @@ -22267,85 +22100,6 @@ ] } }, - "/monit/preview/sync": { - "post": { - "operationId": "monit-preview-sync", - "summary": "同步预览数据源查询", - "description": "同步执行数据源查询并返回原始结果,用于在保存前预览告警规则表达式的效果。", - "tags": [ - "Monitors/通用工具" - ], - "x-mint": { - "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **60 次/分钟**;**10 次/秒** |\n| 权限要求 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- `ds_type` 须与数据源类型匹配,如 `prometheus`、`loki`。\n- `ds_name` 为账户中配置的数据源显示名称。\n- `delay_seconds` 将查询窗口向前偏移指定秒数,用于补偿数据摄入延迟。\n- 响应体为数据源返回的原始 JSON,其结构随数据源类型而异。", - "href": "/zh/api-reference/monitors/monitor-utilities/monit-preview-sync", - "metadata": { - "sidebarTitle": "同步预览数据源查询" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PreviewSyncResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "status": "success", - "data": { - "resultType": "vector", - "result": [] - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PreviewSyncRequest" - }, - "example": { - "ds_type": "prometheus", - "ds_name": "生产 Prometheus", - "expr": "rate(http_requests_total[5m])", - "delay_seconds": 0 - } - } - } - } - } - }, "/status-page/info": { "get": { "operationId": "statusPageInfo", @@ -43705,16 +43459,6 @@ "description": "成功时返回空对象。", "additionalProperties": false }, - "RuleFolderIDRequest": { - "type": "object", - "properties": { - "folder_id": { - "type": "integer", - "format": "uint64", - "description": "要统计的文件夹 ID,可通过 `POST /monit/folder/list` 获取。服务端按直属子文件夹分组返回规则触发统计。" - } - } - }, "RuleFieldsUpdateRequest": { "type": "object", "required": [ @@ -48136,12 +47880,44 @@ } }, "QueryDataRequest": { - "description": "稳定结构化查询接口的请求。字段与已弃用的 rows 接口一致。", - "allOf": [ - { - "$ref": "#/components/schemas/QueryRowsRequest" + "type": "object", + "required": [ + "ds_type", + "ds_name", + "expr" + ], + "properties": { + "account_id": { + "type": "integer", + "format": "int64", + "description": "可选的一致性校验。若提供,必须等于已认证账户;不一致将被拒绝。业务执行始终使用已认证账户。" + }, + "ds_type": { + "type": "string", + "description": "数据源类型;必须匹配租户下已配置的数据源。示例:`prometheus`、`loki`、`victorialogs`、`sls`、`elasticsearch`、`mysql`、`postgres`、`oracle`、`clickhouse`。" + }, + "ds_name": { + "type": "string", + "description": "数据源名称;必须匹配租户下已配置的数据源。" + }, + "expr": { + "type": "string", + "description": "查询表达式。语法取决于 `ds_type`,由对应的 monit-edge 客户端解释(Prometheus 用 PromQL,Loki 用 LogQL,SQL 类数据源用 SQL,等等)。" + }, + "delay_seconds": { + "type": "integer", + "description": "应用于点查询(Prometheus、Loki stats、VictoriaLogs stats)的回看偏移,单位秒。明细 / raw 查询忽略该字段。", + "default": 0 + }, + "args": { + "type": "object", + "description": "透传给 monit-edge 的多态键值扩展参数。所有值必须是字符串,键一律按数据源加前缀(如 `sls.project`、`loki.type`)。校验规则取决于 `ds_type`:SLS 必须提供 `sls.project` 与 `sls.logstore`;Elasticsearch 的 `es.type` 只接受 `sql` 或不传,其他值一律拒绝;Loki 与 VictoriaLogs 的 `.type` 接受 `stats`、`raw` 或不传,其中 `raw` 还必须给出时间范围——`.start` + `.end`,或 `.timespan.value` + `.timespan.unit`(单位取 `s`/`m`/`h`/`d`)。Prometheus 及其余 SQL 类数据源完全忽略 `args`。", + "additionalProperties": { + "type": "string" + } } - ] + }, + "description": "稳定结构化查询接口的请求参数。" }, "QueryDataResponse": { "type": "object", @@ -48367,72 +48143,6 @@ } } }, - "QueryRowsRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "properties": { - "account_id": { - "type": "integer", - "format": "int64", - "description": "可选的一致性校验。若提供,必须等于已认证账户;不一致将被拒绝。业务执行始终使用已认证账户。" - }, - "ds_type": { - "type": "string", - "description": "数据源类型;必须匹配租户下已配置的数据源。示例:`prometheus`、`loki`、`victorialogs`、`sls`、`elasticsearch`、`mysql`、`postgres`、`oracle`、`clickhouse`。" - }, - "ds_name": { - "type": "string", - "description": "数据源名称;必须匹配租户下已配置的数据源。" - }, - "expr": { - "type": "string", - "description": "查询表达式。语法取决于 `ds_type`,由对应的 monit-edge 客户端解释(Prometheus 用 PromQL,Loki 用 LogQL,SQL 类数据源用 SQL,等等)。" - }, - "delay_seconds": { - "type": "integer", - "description": "应用于点查询(Prometheus、Loki stats、VictoriaLogs stats)的回看偏移,单位秒。明细 / raw 查询忽略该字段。", - "default": 0 - }, - "args": { - "type": "object", - "description": "透传给 monit-edge 的多态键值扩展参数。所有值必须是字符串,键一律按数据源加前缀(如 `sls.project`、`loki.type`)。校验规则取决于 `ds_type`:SLS 必须提供 `sls.project` 与 `sls.logstore`;Elasticsearch 的 `es.type` 只接受 `sql` 或不传,其他值一律拒绝;Loki 与 VictoriaLogs 的 `.type` 接受 `stats`、`raw` 或不传,其中 `raw` 还必须给出时间范围——`.start` + `.end`,或 `.timespan.value` + `.timespan.unit`(单位取 `s`/`m`/`h`/`d`)。Prometheus 及其余 SQL 类数据源完全忽略 `args`。", - "additionalProperties": { - "type": "string" - } - } - } - }, - "QueryRowsResponse": { - "type": "array", - "description": "结果行。不同数据源对 `fields` 与 `values` 的填充方式不同——指标类数据源(Prometheus、*-stats)将数字放入 `values`;明细类数据源(SQL、SLS、原始日志)将数据放入 `fields`,`values` 可能为 `null`。", - "items": { - "$ref": "#/components/schemas/QueryRow" - } - }, - "QueryRow": { - "type": "object", - "properties": { - "fields": { - "type": "object", - "description": "字符串值字段(标签、日志字段、SQL 列)。", - "additionalProperties": { - "type": "string" - } - }, - "values": { - "type": "object", - "nullable": true, - "description": "数值字段。对于指标查询,规范键名为 `__value__`。对于明细类数据源可能为 `null`。", - "additionalProperties": { - "type": "number" - } - } - } - }, "DiagnoseRequest": { "type": "object", "required": [ @@ -49824,44 +49534,6 @@ } } }, - "PreviewSyncRequest": { - "type": "object", - "required": [ - "ds_type", - "ds_name", - "expr" - ], - "description": "同步数据源查询预览的参数。", - "properties": { - "ds_type": { - "type": "string", - "description": "数据源类型,如 `prometheus`、`loki`、`elasticsearch`。" - }, - "ds_name": { - "type": "string", - "description": "账户中配置的数据源显示名称。" - }, - "expr": { - "type": "string", - "description": "查询表达式,格式因 `ds_type` 而异(Prometheus 为 PromQL,Loki 为 LogQL 等)。" - }, - "delay_seconds": { - "type": "integer", - "description": "将查询窗口向前偏移的秒数,用于补偿数据摄入延迟。" - }, - "args": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "特定数据源类型的附加查询参数(键值均为字符串),如 SLS 的 `sls.project`、`sls.logstore`,Elasticsearch 的 `es.type`,Loki 的 `loki.type`、`loki.limit`。" - } - } - }, - "PreviewSyncResponse": { - "type": "object", - "description": "数据源返回的原始 JSON,结构随数据源类型而异。" - }, "ResetPostMortemBasicsRequest": { "type": "object", "description": "写回复盘报告的故障基础信息。", diff --git a/docs.json b/docs.json index 300922a..c0ea23c 100644 --- a/docs.json +++ b/docs.json @@ -2444,7 +2444,6 @@ "POST /monit/rule/import", "POST /monit/rule/export", "POST /monit/rule/move", - "POST /monit/rule/status", "POST /monit/rule/audits", "POST /monit/rule/audit/detail", "POST /monit/rule/dstypes", @@ -2483,20 +2482,12 @@ "icon": "stethoscope", "pages": [ "POST /monit/query/data", - "POST /monit/query/rows", "POST /monit/query/diagnose", "POST /monit/tools/catalog", "POST /monit/tools/invoke", "POST /monit/targets" ] }, - { - "group": "通用工具", - "icon": "wrench", - "pages": [ - "POST /monit/preview/sync" - ] - }, { "group": "服务拓扑", "icon": "diagram-project", @@ -3814,7 +3805,6 @@ "POST /monit/rule/import", "POST /monit/rule/export", "POST /monit/rule/move", - "POST /monit/rule/status", "POST /monit/rule/audits", "POST /monit/rule/audit/detail", "POST /monit/rule/dstypes", @@ -3853,20 +3843,12 @@ "icon": "stethoscope", "pages": [ "POST /monit/query/data", - "POST /monit/query/rows", "POST /monit/query/diagnose", "POST /monit/tools/catalog", "POST /monit/tools/invoke", "POST /monit/targets" ] }, - { - "group": "Monitor utilities", - "icon": "wrench", - "pages": [ - "POST /monit/preview/sync" - ] - }, { "group": "Service map", "icon": "diagram-project", diff --git a/en/developer/cli.mdx b/en/developer/cli.mdx index 19a0345..f01fe5e 100644 --- a/en/developer/cli.mdx +++ b/en/developer/cli.mdx @@ -474,12 +474,11 @@ FDUTY ### monit-query — Monitoring datasource queries -Probe monitoring back-end datasources directly, bypassing the alert-rule layer. The `data` subcommand supports 9 datasource types (Prometheus, VictoriaLogs, Loki, MySQL, SLS, Elasticsearch, PostgreSQL, Oracle, ClickHouse); `diagnose` supports `prometheus` (metric trends), `victorialogs`, `loki` (log patterns); the deprecated `rows` supports `prometheus`, `victorialogs`, `loki`, `mysql`. +Probe monitoring back-end datasources directly, bypassing the alert-rule layer. The `data` subcommand supports 9 datasource types (Prometheus, VictoriaLogs, Loki, MySQL, SLS, Elasticsearch, PostgreSQL, Oracle, ClickHouse); `diagnose` supports `prometheus` (metric trends), `victorialogs`, and `loki` (log patterns). ```bash flashduty monit-query diagnose [flags] # Pre-clustered RCA findings (log patterns or metric trends) -flashduty monit-query data [flags] # Structured datasource query (recommended) -flashduty monit-query rows [flags] # Raw datasource passthrough query (deprecated — use data) +flashduty monit-query data [flags] # Structured datasource query ``` Common flags for `diagnose`: diff --git a/en/developer/go-sdk.mdx b/en/developer/go-sdk.mdx index aedace5..81cb285 100644 --- a/en/developer/go-sdk.mdx +++ b/en/developer/go-sdk.mdx @@ -161,7 +161,6 @@ Endpoints are grouped by service and hang off the client: the call convention is | `client.NotificationTemplates` | Notification templates | | `client.Changes` | Changes | | `client.Diagnostics` | Diagnostics | -| `client.MonitorUtilities` | Monitor datasource preview | | `client.ServiceMap` | Service map (ServiceMap) | | `client.Analytics` | Analytics | | `client.A2aAgents` | A2A Agents | @@ -182,7 +181,7 @@ Endpoints are grouped by service and hang off the client: the call convention is `client.Knowledge` covers the 9 operations under `/safari/knowledge/*`: on the pack side `PackReadGet` (get the account pack), `PackReadList` (list packs), `PackWriteEnsure` (ensure a pack exists), `PackWriteUpdate` (change a pack's scope), and `PackWriteDelete` (delete a pack); on the file side `FileReadGet`, `FileReadList`, `FileWritePut` (upload/overwrite), and `FileWriteDelete`. Exported types include `KnowledgePackItem`, `KnowledgeFileItem`, `KnowledgeWarning`, and the various `Knowledge*Request` / `Knowledge*Response` structs. -`client.Diagnostics` (diagnostics) provides datasource query methods: `QueryData` runs a synchronous query via `POST /monit/query/data` and returns a stable `query_result.v1` structured result (`format` is always `query_result.v1`; `result.kind` is one of `frames` / `records` / `samples`). This API requires monit-edge v0.65.0 or later. `QueryRows` (`POST /monit/query/rows`) is deprecated and returns the legacy flattened rows shape — migrate to `QueryData`. `QueryDiagnose` (`POST /monit/query/diagnose`) runs pre-clustered RCA analysis (log patterns or metric trends) and can take up to 35 seconds. +`client.Diagnostics` (diagnostics) provides datasource query methods: `QueryData` runs a synchronous query via `POST /monit/query/data` and returns a stable `query_result.v1` structured result (`format` is always `query_result.v1`; `result.kind` is one of `frames` / `records` / `samples`). This API requires monit-edge v0.65.0 or later. `QueryDiagnose` (`POST /monit/query/diagnose`) runs pre-clustered RCA analysis (log patterns or metric trends) and can take up to 35 seconds. All identifiers, service field names, and method names match the generated code. For exactly which methods each service has and their request and response types, rely on `services_gen.go` and the per-service files, plus the [Open API reference](/en/openapi/introduction). diff --git a/en/openapi/api-catalog.mdx b/en/openapi/api-catalog.mdx index 64823d4..5a9e9bf 100644 --- a/en/openapi/api-catalog.mdx +++ b/en/openapi/api-catalog.mdx @@ -3,7 +3,7 @@ title: "API Catalog" description: "Complete list of Flashduty Open API endpoints, organized by product module with links to detailed documentation" --- -Flashduty Open API provides **338** endpoints covering five major modules: On-call, Monitors, RUM, AI SRE, and Platform. All endpoints use unified authentication and request specifications. See [Quick Start](/en/openapi/introduction) for details. +Flashduty Open API provides **335** endpoints covering five major modules: On-call, Monitors, RUM, AI SRE, and Platform. All endpoints use unified authentication and request specifications. See [Quick Start](/en/openapi/introduction) for details. All endpoint URLs use `https://api.flashcat.cloud` as the base, authenticated via APP Key through query string. @@ -269,7 +269,7 @@ All endpoint URLs use `https://api.flashcat.cloud` as the base, authenticated vi - + ### Alert rules @@ -285,7 +285,6 @@ All endpoint URLs use `https://api.flashcat.cloud` as the base, authenticated vi | POST | [`/monit/rule/import`](/en/api-reference/monitors/alert-rules/monit-rule-write-import) | Import alert rules | | POST | [`/monit/rule/export`](/en/api-reference/monitors/alert-rules/monit-rule-read-export) | Export alert rules | | POST | [`/monit/rule/move`](/en/api-reference/monitors/alert-rules/monit-rule-write-move) | Move alert rules to folder | -| POST | [`/monit/rule/status`](/en/api-reference/monitors/alert-rules/monit-rule-write-status) | Get rule trigger status under folder | | POST | [`/monit/rule/audits`](/en/api-reference/monitors/alert-rules/monit-rule-read-audits) | List rule change history | | POST | [`/monit/rule/audit/detail`](/en/api-reference/monitors/alert-rules/monit-rule-read-audit-detail) | Get rule audit snapshot | | POST | [`/monit/rule/dstypes`](/en/api-reference/monitors/alert-rules/monit-rule-read-dstypes) | List available datasource types | @@ -321,18 +320,11 @@ All endpoint URLs use `https://api.flashcat.cloud` as the base, authenticated vi | Method | Endpoint | Description | | :--- | :--- | :--- | | POST | [`/monit/query/data`](/en/api-reference/monitors/diagnostics/monit-read-query-data) | Query structured data | -| POST | [`/monit/query/rows`](/en/api-reference/monitors/diagnostics/monit-read-query-rows) | Query data source rows | | POST | [`/monit/query/diagnose`](/en/api-reference/monitors/diagnostics/monit-read-query-diagnose) | Diagnose data source | | POST | [`/monit/tools/catalog`](/en/api-reference/monitors/diagnostics/monit-read-tools-catalog) | List target tool catalog | | POST | [`/monit/tools/invoke`](/en/api-reference/monitors/diagnostics/monit-read-tools-invoke) | Invoke target tools | | POST | [`/monit/targets`](/en/api-reference/monitors/diagnostics/monit-read-targets-list) | List monitored targets | -### Monitor utilities - -| Method | Endpoint | Description | -| :--- | :--- | :--- | -| POST | [`/monit/preview/sync`](/en/api-reference/monitors/monitor-utilities/monit-preview-sync) | Preview datasource query | - ### Service map | Method | Endpoint | Description | diff --git a/zh/developer/cli.mdx b/zh/developer/cli.mdx index e57bc76..6d46058 100644 --- a/zh/developer/cli.mdx +++ b/zh/developer/cli.mdx @@ -474,12 +474,11 @@ FDUTY ### monit-query — 监控数据源查询 -直接探测监控后端数据源,无需经过告警规则层。`data` 子命令支持 9 种数据源类型(Prometheus、VictoriaLogs、Loki、MySQL、SLS、Elasticsearch、PostgreSQL、Oracle、ClickHouse);`diagnose` 支持 `prometheus`(指标趋势)、`victorialogs`、`loki`(日志模式);已弃用的 `rows` 支持 `prometheus`、`victorialogs`、`loki`、`mysql`。 +直接探测监控后端数据源,无需经过告警规则层。`data` 子命令支持 9 种数据源类型(Prometheus、VictoriaLogs、Loki、MySQL、SLS、Elasticsearch、PostgreSQL、Oracle、ClickHouse);`diagnose` 支持 `prometheus`(指标趋势)、`victorialogs` 和 `loki`(日志模式)。 ```bash flashduty monit-query diagnose [flags] # 预聚合 RCA 分析(日志模式或指标趋势) -flashduty monit-query data [flags] # 结构化数据源查询(推荐) -flashduty monit-query rows [flags] # 原始数据直通查询(已弃用,请改用 data) +flashduty monit-query data [flags] # 结构化数据源查询 ``` `diagnose` 常用参数: diff --git a/zh/developer/go-sdk.mdx b/zh/developer/go-sdk.mdx index dde3ba5..3800145 100644 --- a/zh/developer/go-sdk.mdx +++ b/zh/developer/go-sdk.mdx @@ -161,7 +161,6 @@ client, err := flashduty.NewClient("YOUR_APP_KEY", | `client.NotificationTemplates` | 通知模板 | | `client.Changes` | 变更 | | `client.Diagnostics` | 诊断 | -| `client.MonitorUtilities` | 监控数据源预览 | | `client.ServiceMap` | 服务拓扑(ServiceMap) | | `client.Analytics` | 分析 | | `client.A2aAgents` | A2A Agents | @@ -182,7 +181,7 @@ client, err := flashduty.NewClient("YOUR_APP_KEY", `client.Knowledge` 对应 `/safari/knowledge/*` 的 9 个 API 操作:知识包侧为 `PackReadGet`(获取账户知识包)、`PackReadList`(列出知识包)、`PackWriteEnsure`(确保知识包存在)、`PackWriteUpdate`(变更知识包作用域)、`PackWriteDelete`(删除知识包);知识文件侧为 `FileReadGet`、`FileReadList`、`FileWritePut`(上传/覆盖)、`FileWriteDelete`。相关导出类型包括 `KnowledgePackItem`、`KnowledgeFileItem`、`KnowledgeWarning` 以及各 `Knowledge*Request` / `Knowledge*Response`。 -`client.Diagnostics`(诊断)提供数据源查询方法:`QueryData` 通过 `POST /monit/query/data` 执行同步查询,返回稳定的 `query_result.v1` 结构化结果(`format` 固定为 `query_result.v1`,`result.kind` 为 `frames` / `records` / `samples` 之一),该接口要求 monit-edge v0.65.0 及以上版本;`QueryRows`(`POST /monit/query/rows`)已弃用,返回历史压平的行结构,建议迁移到 `QueryData`;`QueryDiagnose`(`POST /monit/query/diagnose`)用于预聚合 RCA 分析(日志模式或指标趋势),最长运行 35 秒。 +`client.Diagnostics`(诊断)提供数据源查询方法:`QueryData` 通过 `POST /monit/query/data` 执行同步查询,返回稳定的 `query_result.v1` 结构化结果(`format` 固定为 `query_result.v1`,`result.kind` 为 `frames` / `records` / `samples` 之一),该接口要求 monit-edge v0.65.0 及以上版本;`QueryDiagnose`(`POST /monit/query/diagnose`)用于预聚合 RCA 分析(日志模式或指标趋势),最长运行 35 秒。 所有标识符、服务字段名与方法名均与生成代码保持一致。具体每个服务有哪些方法、请求与响应类型,请以 `services_gen.go` 与各服务文件,以及 [Open API 参考](/zh/openapi/introduction) 为准。 diff --git a/zh/openapi/api-catalog.mdx b/zh/openapi/api-catalog.mdx index 8b121c6..b8b716c 100644 --- a/zh/openapi/api-catalog.mdx +++ b/zh/openapi/api-catalog.mdx @@ -3,7 +3,7 @@ title: "API 目录" description: "Flashduty Open API 接口完整列表,按产品模块组织并链接到详细文档" --- -Flashduty Open API 提供 **338** 个接口,覆盖 On-call、Monitors、RUM、AI SRE 和平台五个主要模块。所有接口使用统一认证方式和请求规范。详情参见[快速开始](/zh/openapi/introduction)。 +Flashduty Open API 提供 **335** 个接口,覆盖 On-call、Monitors、RUM、AI SRE 和平台五个主要模块。所有接口使用统一认证方式和请求规范。详情参见[快速开始](/zh/openapi/introduction)。 所有接口 URL 均以 `https://api.flashcat.cloud` 为 base,通过 query string 中的 APP Key 认证。 @@ -269,7 +269,7 @@ Flashduty Open API 提供 **338** 个接口,覆盖 On-call、Monitors、RUM、 - + ### 告警规则 @@ -285,7 +285,6 @@ Flashduty Open API 提供 **338** 个接口,覆盖 On-call、Monitors、RUM、 | POST | [`/monit/rule/import`](/zh/api-reference/monitors/alert-rules/monit-rule-write-import) | 导入告警规则 | | POST | [`/monit/rule/export`](/zh/api-reference/monitors/alert-rules/monit-rule-read-export) | 导出告警规则 | | POST | [`/monit/rule/move`](/zh/api-reference/monitors/alert-rules/monit-rule-write-move) | 移动告警规则到文件夹 | -| POST | [`/monit/rule/status`](/zh/api-reference/monitors/alert-rules/monit-rule-write-status) | 查看文件夹下规则触发状态 | | POST | [`/monit/rule/audits`](/zh/api-reference/monitors/alert-rules/monit-rule-read-audits) | 查询规则变更历史 | | POST | [`/monit/rule/audit/detail`](/zh/api-reference/monitors/alert-rules/monit-rule-read-audit-detail) | 查看规则审计快照 | | POST | [`/monit/rule/dstypes`](/zh/api-reference/monitors/alert-rules/monit-rule-read-dstypes) | 查询可用的数据源类型 | @@ -321,18 +320,11 @@ Flashduty Open API 提供 **338** 个接口,覆盖 On-call、Monitors、RUM、 | 方法 | 接口 | 描述 | | :--- | :--- | :--- | | POST | [`/monit/query/data`](/zh/api-reference/monitors/diagnostics/monit-read-query-data) | 查询结构化数据 | -| POST | [`/monit/query/rows`](/zh/api-reference/monitors/diagnostics/monit-read-query-rows) | 查询数据源原始行 | | POST | [`/monit/query/diagnose`](/zh/api-reference/monitors/diagnostics/monit-read-query-diagnose) | 数据源诊断 | | POST | [`/monit/tools/catalog`](/zh/api-reference/monitors/diagnostics/monit-read-tools-catalog) | 查询监控对象工具能力清单 | | POST | [`/monit/tools/invoke`](/zh/api-reference/monitors/diagnostics/monit-read-tools-invoke) | 调用监控对象工具 | | POST | [`/monit/targets`](/zh/api-reference/monitors/diagnostics/monit-read-targets-list) | 监控对象列表 | -### 通用工具 - -| 方法 | 接口 | 描述 | -| :--- | :--- | :--- | -| POST | [`/monit/preview/sync`](/zh/api-reference/monitors/monitor-utilities/monit-preview-sync) | 同步预览数据源查询 | - ### 服务拓扑 | 方法 | 接口 | 描述 |