mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 07:06:36 +08:00
feat: 添加节点可观测性查询功能,支持获取节点的系统配置、指标快照、流量报告和健康事件
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
NodeBootstrapToken,
|
||||
NodeItem,
|
||||
NodeMutationPayload,
|
||||
NodeObservability,
|
||||
} from '@/features/nodes/types';
|
||||
import type { ReleaseChannel } from '@/features/update/types';
|
||||
|
||||
@@ -67,3 +68,20 @@ export function requestNodeOpenrestyRestart(id: number) {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export function getNodeObservability(
|
||||
id: number,
|
||||
options?: { hours?: number; limit?: number },
|
||||
) {
|
||||
const params = new URLSearchParams();
|
||||
if (options?.hours) {
|
||||
params.set('hours', String(options.hours));
|
||||
}
|
||||
if (options?.limit) {
|
||||
params.set('limit', String(options.limit));
|
||||
}
|
||||
const query = params.toString();
|
||||
return apiRequest<NodeObservability>(
|
||||
`/nodes/${id}/observability${query ? `?${query}` : ''}`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user