|
32 | 32 | { |
33 | 33 | "name": "Monitors/Diagnostics", |
34 | 34 | "description": "Diagnostic and query endpoints used by Flashduty AI SRE — ad-hoc data source queries, log/metric diagnostics, and target-side tool invocation." |
| 35 | + }, |
| 36 | + { |
| 37 | + "name": "Monitors/Monitor utilities", |
| 38 | + "description": "Monitors service activation and data preview utilities." |
35 | 39 | } |
36 | 40 | ], |
37 | 41 | "paths": { |
|
2981 | 2985 | } |
2982 | 2986 | } |
2983 | 2987 | } |
| 2988 | + }, |
| 2989 | + "/monit/preview/sync": { |
| 2990 | + "post": { |
| 2991 | + "operationId": "monit-preview-sync", |
| 2992 | + "summary": "Preview datasource query", |
| 2993 | + "description": "Execute a synchronous datasource query and return the raw result. Used to preview alert rule expressions before saving.", |
| 2994 | + "tags": [ |
| 2995 | + "Monitors/Monitor utilities" |
| 2996 | + ], |
| 2997 | + "x-mint": { |
| 2998 | + "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.", |
| 2999 | + "href": "/en/api-reference/monitors/monitor-utilities/monit-preview-sync", |
| 3000 | + "metadata": { |
| 3001 | + "sidebarTitle": "Preview datasource query" |
| 3002 | + } |
| 3003 | + }, |
| 3004 | + "responses": { |
| 3005 | + "200": { |
| 3006 | + "description": "Success", |
| 3007 | + "content": { |
| 3008 | + "application/json": { |
| 3009 | + "schema": { |
| 3010 | + "allOf": [ |
| 3011 | + { |
| 3012 | + "$ref": "#/components/schemas/SuccessEnvelope" |
| 3013 | + }, |
| 3014 | + { |
| 3015 | + "type": "object", |
| 3016 | + "properties": { |
| 3017 | + "data": { |
| 3018 | + "$ref": "#/components/schemas/PreviewSyncResponse" |
| 3019 | + } |
| 3020 | + } |
| 3021 | + } |
| 3022 | + ] |
| 3023 | + }, |
| 3024 | + "example": { |
| 3025 | + "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", |
| 3026 | + "data": { |
| 3027 | + "status": "success", |
| 3028 | + "data": { |
| 3029 | + "resultType": "vector", |
| 3030 | + "result": [] |
| 3031 | + } |
| 3032 | + } |
| 3033 | + } |
| 3034 | + } |
| 3035 | + } |
| 3036 | + }, |
| 3037 | + "400": { |
| 3038 | + "$ref": "#/components/responses/BadRequest" |
| 3039 | + }, |
| 3040 | + "401": { |
| 3041 | + "$ref": "#/components/responses/Unauthorized" |
| 3042 | + }, |
| 3043 | + "429": { |
| 3044 | + "$ref": "#/components/responses/TooManyRequests" |
| 3045 | + }, |
| 3046 | + "500": { |
| 3047 | + "$ref": "#/components/responses/ServerError" |
| 3048 | + } |
| 3049 | + }, |
| 3050 | + "requestBody": { |
| 3051 | + "required": true, |
| 3052 | + "content": { |
| 3053 | + "application/json": { |
| 3054 | + "schema": { |
| 3055 | + "$ref": "#/components/schemas/PreviewSyncRequest" |
| 3056 | + }, |
| 3057 | + "example": { |
| 3058 | + "ds_type": "prometheus", |
| 3059 | + "ds_name": "Prometheus Prod", |
| 3060 | + "expr": "rate(http_requests_total[5m])", |
| 3061 | + "delay_seconds": 0 |
| 3062 | + } |
| 3063 | + } |
| 3064 | + } |
| 3065 | + } |
| 3066 | + } |
2984 | 3067 | } |
2985 | 3068 | }, |
2986 | 3069 | "components": { |
|
5614 | 5697 | "description": "Opaque cursor for the next page. Absent / empty means this is the last page." |
5615 | 5698 | } |
5616 | 5699 | } |
| 5700 | + }, |
| 5701 | + "PreviewSyncRequest": { |
| 5702 | + "type": "object", |
| 5703 | + "required": [ |
| 5704 | + "ds_type", |
| 5705 | + "ds_name", |
| 5706 | + "expr" |
| 5707 | + ], |
| 5708 | + "description": "Parameters for a synchronous datasource query preview.", |
| 5709 | + "properties": { |
| 5710 | + "ds_type": { |
| 5711 | + "type": "string", |
| 5712 | + "description": "Datasource type, e.g. `prometheus`, `loki`, `elasticsearch`." |
| 5713 | + }, |
| 5714 | + "ds_name": { |
| 5715 | + "type": "string", |
| 5716 | + "description": "Datasource display name as configured in the account." |
| 5717 | + }, |
| 5718 | + "expr": { |
| 5719 | + "type": "string", |
| 5720 | + "description": "Query expression. Format depends on `ds_type` (PromQL for Prometheus, LogQL for Loki, etc.)." |
| 5721 | + }, |
| 5722 | + "delay_seconds": { |
| 5723 | + "type": "integer", |
| 5724 | + "description": "Shift the query window backward by this many seconds to compensate for data ingestion latency." |
| 5725 | + }, |
| 5726 | + "args": { |
| 5727 | + "type": "object", |
| 5728 | + "additionalProperties": { |
| 5729 | + "type": "string" |
| 5730 | + }, |
| 5731 | + "description": "Additional type-specific query arguments." |
| 5732 | + } |
| 5733 | + } |
| 5734 | + }, |
| 5735 | + "PreviewSyncResponse": { |
| 5736 | + "type": "object", |
| 5737 | + "description": "Raw JSON response from the datasource. Schema varies by datasource type." |
5617 | 5738 | } |
5618 | 5739 | } |
5619 | 5740 | } |
|
0 commit comments