Skip to content

Commit 1e9f268

Browse files
aice030LiusCraft
authored andcommitted
补充了四个黄金指标展示窗口,并可获取api返回的数据
1 parent 1524be1 commit 1e9f268

File tree

2 files changed

+385
-1
lines changed

2 files changed

+385
-1
lines changed

client/src/api/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ export const apiService = {
6565
return api.get(`/v1/deployments?type=schedule&service=${serviceName}`)
6666
},
6767

68+
// 获取服务指标数据 - 新的接口
69+
getServiceMetricsData: (serviceName: string, metricName: string, version: string) => {
70+
const now = new Date()
71+
const thirtyMinutesAgo = new Date(now.getTime() - 30 * 60 * 1000) // 30分钟前
72+
73+
const start = thirtyMinutesAgo.toISOString()
74+
const end = now.toISOString()
75+
const granule = '5m' // 写死,每5分钟一个数据点
76+
77+
return api.get(`/v1/metrics/${serviceName}/${metricName}?version=${version}&start=${start}&end=${end}&granule=${granule}`)
78+
},
79+
6880
// 获取版本选项 - 新的接口
6981
getVersionOptions: () => {
7082
return api.get('/v1/versions')

0 commit comments

Comments
 (0)