Commit f28d4b78 authored by IanShaw027's avatar IanShaw027
Browse files

feat(ops): 前端添加指标阈值类型定义和API

- 添加OpsMetricThresholds类型定义
- 新增getMetricThresholds和updateMetricThresholds API方法
parent 7536dbfe
...@@ -661,6 +661,14 @@ export interface EmailNotificationConfig { ...@@ -661,6 +661,14 @@ export interface EmailNotificationConfig {
} }
} }
export interface OpsMetricThresholds {
sla_percent_min?: number | null // SLA低于此值变红
latency_p99_ms_max?: number | null // 延迟P99高于此值变红
ttft_p99_ms_max?: number | null // TTFT P99高于此值变红
request_error_rate_percent_max?: number | null // 请求错误率高于此值变红
upstream_error_rate_percent_max?: number | null // 上游错误率高于此值变红
}
export interface OpsDistributedLockSettings { export interface OpsDistributedLockSettings {
enabled: boolean enabled: boolean
key: string key: string
...@@ -681,6 +689,7 @@ export interface OpsAlertRuntimeSettings { ...@@ -681,6 +689,7 @@ export interface OpsAlertRuntimeSettings {
reason: string reason: string
}> }>
} }
thresholds: OpsMetricThresholds // 指标阈值配置
} }
export interface OpsAdvancedSettings { export interface OpsAdvancedSettings {
...@@ -929,6 +938,17 @@ export async function updateAdvancedSettings(config: OpsAdvancedSettings): Promi ...@@ -929,6 +938,17 @@ export async function updateAdvancedSettings(config: OpsAdvancedSettings): Promi
return data return data
} }
// ==================== Metric Thresholds ====================
async function getMetricThresholds(): Promise<OpsMetricThresholds> {
const { data } = await apiClient.get<OpsMetricThresholds>('/admin/ops/settings/metric-thresholds')
return data
}
async function updateMetricThresholds(thresholds: OpsMetricThresholds): Promise<void> {
await apiClient.put('/admin/ops/settings/metric-thresholds', thresholds)
}
export const opsAPI = { export const opsAPI = {
getDashboardOverview, getDashboardOverview,
getThroughputTrend, getThroughputTrend,
...@@ -952,7 +972,9 @@ export const opsAPI = { ...@@ -952,7 +972,9 @@ export const opsAPI = {
getAlertRuntimeSettings, getAlertRuntimeSettings,
updateAlertRuntimeSettings, updateAlertRuntimeSettings,
getAdvancedSettings, getAdvancedSettings,
updateAdvancedSettings updateAdvancedSettings,
getMetricThresholds,
updateMetricThresholds
} }
export default opsAPI export default opsAPI
...@@ -14,6 +14,7 @@ export type { ...@@ -14,6 +14,7 @@ export type {
EmailNotificationConfig, EmailNotificationConfig,
OpsDistributedLockSettings, OpsDistributedLockSettings,
OpsAlertRuntimeSettings, OpsAlertRuntimeSettings,
OpsMetricThresholds,
OpsAdvancedSettings, OpsAdvancedSettings,
OpsDataRetentionSettings, OpsDataRetentionSettings,
OpsAggregationSettings OpsAggregationSettings
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment