-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiagnostics.go
More file actions
78 lines (70 loc) · 3.36 KB
/
Copy pathdiagnostics.go
File metadata and controls
78 lines (70 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Code generated by internal/cmd/gen; DO NOT EDIT.
package flashduty
import "context"
// DiagnosticsService handles the "Monitors/Diagnostics" API resource.
type DiagnosticsService service
// Diagnose data source.
//
// Run a synchronous diagnostic query (`log_patterns` for Loki/VictoriaLogs, `metric_trends` for Prometheus). Used by Flashduty AI SRE for log-pattern clustering and time-series trend analysis. Long-running — up to 35 s.
//
// API: POST /monit/query/diagnose (monit-read-query-diagnose).
func (s *DiagnosticsService) QueryDiagnose(ctx context.Context, req *DiagnoseRequest) (*DiagnoseResponse, *Response, error) {
out := new(DiagnoseResponse)
resp, err := s.client.do(ctx, "/monit/query/diagnose", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Query data source rows.
//
// Run a synchronous ad-hoc query against a configured data source and get back its raw rows. Used by Flashduty AI SRE and by UI preview. The request is forwarded over WebSocket to monit-edge, which executes the query against the underlying source (Prometheus / Loki / VictoriaLogs / SLS / MySQL / Postgres / Oracle / ClickHouse / Elasticsearch).
//
// API: POST /monit/query/rows (monit-read-query-rows).
func (s *DiagnosticsService) QueryRows(ctx context.Context, req *QueryRowsRequest) (*QueryRowsResponse, *Response, error) {
out := new(QueryRowsResponse)
resp, err := s.client.do(ctx, "/monit/query/rows", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List monitored targets.
//
// List the targets observed under the current tenant by the monit-agent route projection. Supports `target_locator` prefix search and cursor pagination. Use this to drive `target_locator` selection for `/monit/tools/catalog` and `/monit/tools/invoke`.
//
// API: POST /monit/targets (monit-read-targets-list).
func (s *DiagnosticsService) TargetsList(ctx context.Context, req *TargetsListRequest) (*TargetsListResponse, *Response, error) {
out := new(TargetsListResponse)
resp, err := s.client.do(ctx, "/monit/targets", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List target tool catalog.
//
// Look up the tools that the per-target monit-agent currently exposes for a given `target_locator` (host, mysql, …). Returns each tool's name, description, and JSON-Schema `input_schema`. Pair with `/monit/tools/invoke` to drive AI-SRE tool calls.
//
// API: POST /monit/tools/catalog (monit-read-tools-catalog).
func (s *DiagnosticsService) ToolsCatalog(ctx context.Context, req *ToolCatalogRequest) (*ToolCatalogResponse, *Response, error) {
out := new(ToolCatalogResponse)
resp, err := s.client.do(ctx, "/monit/tools/catalog", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Invoke target tools.
//
// Invoke up to 8 monit-agent tools concurrently on a single target. Results come back in the order of the input `tools` array. Long-running — individual tools have per-tool timeouts on the agent and the whole request may take tens of seconds.
//
// API: POST /monit/tools/invoke (monit-read-tools-invoke).
func (s *DiagnosticsService) ToolsInvoke(ctx context.Context, req *ToolInvokeRequest) (*ToolInvokeResponse, *Response, error) {
out := new(ToolInvokeResponse)
resp, err := s.client.do(ctx, "/monit/tools/invoke", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}