Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions api-reference/monitors.openapi.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
{
"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."
}
],
"paths": {
Expand Down Expand Up @@ -2981,6 +2985,85 @@
}
}
}
},
"/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
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -5614,6 +5697,44 @@
"description": "Opaque cursor for the next page. Absent / empty means this is the last page."
}
}
},
"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 type-specific query arguments."
}
}
},
"PreviewSyncResponse": {
"type": "object",
"description": "Raw JSON response from the datasource. Schema varies by datasource type."
}
}
}
Expand Down
121 changes: 121 additions & 0 deletions api-reference/monitors.openapi.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
{
"name": "Monitors/诊断分析",
"description": "Flashduty AI SRE 使用的诊断与查询接口——数据源即席查询、日志/指标诊断,以及监控对象侧的工具调用。"
},
{
"name": "Monitors/通用工具",
"description": "监控服务开通及数据预览工具。"
}
],
"paths": {
Expand Down Expand Up @@ -2981,6 +2985,85 @@
}
}
}
},
"/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
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -5614,6 +5697,44 @@
"description": "下一页的不透明游标。缺失 / 为空表示已到末页。"
}
}
},
"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": "特定类型的额外查询参数。"
}
}
},
"PreviewSyncResponse": {
"type": "object",
"description": "数据源返回的原始 JSON,结构随数据源类型而异。"
}
}
}
Expand Down
Loading