Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
b8da5d45
Commit
b8da5d45
authored
Jan 14, 2026
by
IanShaw027
Browse files
feat(api): 扩展前端ops API接口
- 新增告警静默相关API调用 - 增强错误日志查询和过滤接口 - 添加重试和解决状态管理接口
parent
659df6e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/api/admin/ops.ts
View file @
b8da5d45
...
@@ -17,6 +17,33 @@ export interface OpsRequestOptions {
...
@@ -17,6 +17,33 @@ export interface OpsRequestOptions {
export
interface
OpsRetryRequest
{
export
interface
OpsRetryRequest
{
mode
:
OpsRetryMode
mode
:
OpsRetryMode
pinned_account_id
?:
number
pinned_account_id
?:
number
force
?:
boolean
}
export
interface
OpsRetryAttempt
{
id
:
number
created_at
:
string
requested_by_user_id
:
number
source_error_id
:
number
mode
:
OpsRetryMode
|
string
pinned_account_id
?:
number
|
null
status
:
string
started_at
?:
string
|
null
finished_at
?:
string
|
null
duration_ms
?:
number
|
null
success
?:
boolean
|
null
http_status_code
?:
number
|
null
upstream_request_id
?:
string
|
null
used_account_id
?:
number
|
null
response_preview
?:
string
|
null
response_truncated
?:
boolean
|
null
result_request_id
?:
string
|
null
result_error_id
?:
number
|
null
error_message
?:
string
|
null
}
}
export
interface
OpsRetryResult
{
export
interface
OpsRetryResult
{
...
@@ -663,7 +690,7 @@ export interface AlertEvent {
...
@@ -663,7 +690,7 @@ export interface AlertEvent {
id
:
number
id
:
number
rule_id
:
number
rule_id
:
number
severity
:
OpsSeverity
|
string
severity
:
OpsSeverity
|
string
status
:
'
firing
'
|
'
resolved
'
|
string
status
:
'
firing
'
|
'
resolved
'
|
'
manual_resolved
'
|
string
title
?:
string
title
?:
string
description
?:
string
description
?:
string
metric_value
?:
number
metric_value
?:
number
...
@@ -701,10 +728,10 @@ export interface EmailNotificationConfig {
...
@@ -701,10 +728,10 @@ export interface EmailNotificationConfig {
}
}
export
interface
OpsMetricThresholds
{
export
interface
OpsMetricThresholds
{
sla_percent_min
?:
number
|
null
// SLA低于此值变红
sla_percent_min
?:
number
|
null
// SLA低于此值变红
latency_p99_ms_max
?:
number
|
null
// 延迟P99高于此值变红
latency_p99_ms_max
?:
number
|
null
// 延迟
P99
高于此值变红
ttft_p99_ms_max
?:
number
|
null
// TTFT P99高于此值变红
ttft_p99_ms_max
?:
number
|
null
// TTFT P99高于此值变红
request_error_rate_percent_max
?:
number
|
null
// 请求错误率高于此值变红
request_error_rate_percent_max
?:
number
|
null
// 请求错误率高于此值变红
upstream_error_rate_percent_max
?:
number
|
null
// 上游错误率高于此值变红
upstream_error_rate_percent_max
?:
number
|
null
// 上游错误率高于此值变红
}
}
...
@@ -754,13 +781,27 @@ export interface OpsAggregationSettings {
...
@@ -754,13 +781,27 @@ export interface OpsAggregationSettings {
export
interface
OpsErrorLog
{
export
interface
OpsErrorLog
{
id
:
number
id
:
number
created_at
:
string
created_at
:
string
// Standardized classification
phase
:
OpsPhase
phase
:
OpsPhase
type
:
string
type
:
string
error_owner
:
'
client
'
|
'
provider
'
|
'
platform
'
|
string
error_source
:
'
client_request
'
|
'
upstream_http
'
|
'
gateway
'
|
string
severity
:
OpsSeverity
severity
:
OpsSeverity
status_code
:
number
status_code
:
number
platform
:
string
platform
:
string
model
:
string
model
:
string
latency_ms
?:
number
|
null
latency_ms
?:
number
|
null
is_retryable
:
boolean
retry_count
:
number
resolved
:
boolean
resolved_at
?:
string
|
null
resolved_by_user_id
?:
number
|
null
resolved_retry_id
?:
number
|
null
client_request_id
:
string
client_request_id
:
string
request_id
:
string
request_id
:
string
message
:
string
message
:
string
...
@@ -899,7 +940,12 @@ export async function listErrorLogs(params: {
...
@@ -899,7 +940,12 @@ export async function listErrorLogs(params: {
platform
?:
string
platform
?:
string
group_id
?:
number
|
null
group_id
?:
number
|
null
account_id
?:
number
|
null
account_id
?:
number
|
null
phase
?:
string
phase
?:
string
error_owner
?:
string
error_source
?:
string
resolved
?:
string
q
?:
string
q
?:
string
status_codes
?:
string
status_codes
?:
string
}):
Promise
<
OpsErrorLogsResponse
>
{
}):
Promise
<
OpsErrorLogsResponse
>
{
...
@@ -917,6 +963,15 @@ export async function retryErrorRequest(id: number, req: OpsRetryRequest): Promi
...
@@ -917,6 +963,15 @@ export async function retryErrorRequest(id: number, req: OpsRetryRequest): Promi
return
data
return
data
}
}
export
async
function
listRetryAttempts
(
errorId
:
number
,
limit
=
50
):
Promise
<
OpsRetryAttempt
[]
>
{
const
{
data
}
=
await
apiClient
.
get
<
OpsRetryAttempt
[]
>
(
`/admin/ops/errors/
${
errorId
}
/retries`
,
{
params
:
{
limit
}
})
return
data
}
export
async
function
updateErrorResolved
(
errorId
:
number
,
resolved
:
boolean
):
Promise
<
void
>
{
await
apiClient
.
put
(
`/admin/ops/errors/
${
errorId
}
/resolve`
,
{
resolved
})
}
export
async
function
listRequestDetails
(
params
:
OpsRequestDetailsParams
):
Promise
<
OpsRequestDetailsResponse
>
{
export
async
function
listRequestDetails
(
params
:
OpsRequestDetailsParams
):
Promise
<
OpsRequestDetailsResponse
>
{
const
{
data
}
=
await
apiClient
.
get
<
OpsRequestDetailsResponse
>
(
'
/admin/ops/requests
'
,
{
params
})
const
{
data
}
=
await
apiClient
.
get
<
OpsRequestDetailsResponse
>
(
'
/admin/ops/requests
'
,
{
params
})
return
data
return
data
...
@@ -942,11 +997,45 @@ export async function deleteAlertRule(id: number): Promise<void> {
...
@@ -942,11 +997,45 @@ export async function deleteAlertRule(id: number): Promise<void> {
await
apiClient
.
delete
(
`/admin/ops/alert-rules/
${
id
}
`
)
await
apiClient
.
delete
(
`/admin/ops/alert-rules/
${
id
}
`
)
}
}
export
async
function
listAlertEvents
(
limit
=
100
):
Promise
<
AlertEvent
[]
>
{
export
interface
AlertEventsQuery
{
const
{
data
}
=
await
apiClient
.
get
<
AlertEvent
[]
>
(
'
/admin/ops/alert-events
'
,
{
params
:
{
limit
}
})
limit
?:
number
status
?:
string
severity
?:
string
email_sent
?:
boolean
time_range
?:
string
start_time
?:
string
end_time
?:
string
before_fired_at
?:
string
before_id
?:
number
platform
?:
string
group_id
?:
number
}
export
async
function
listAlertEvents
(
params
:
AlertEventsQuery
=
{}):
Promise
<
AlertEvent
[]
>
{
const
{
data
}
=
await
apiClient
.
get
<
AlertEvent
[]
>
(
'
/admin/ops/alert-events
'
,
{
params
})
return
data
return
data
}
}
export
async
function
getAlertEvent
(
id
:
number
):
Promise
<
AlertEvent
>
{
const
{
data
}
=
await
apiClient
.
get
<
AlertEvent
>
(
`/admin/ops/alert-events/
${
id
}
`
)
return
data
}
export
async
function
updateAlertEventStatus
(
id
:
number
,
status
:
'
resolved
'
|
'
manual_resolved
'
):
Promise
<
void
>
{
await
apiClient
.
put
(
`/admin/ops/alert-events/
${
id
}
/status`
,
{
status
})
}
export
async
function
createAlertSilence
(
payload
:
{
rule_id
:
number
platform
:
string
group_id
?:
number
|
null
region
?:
string
|
null
until
:
string
reason
?:
string
}):
Promise
<
void
>
{
await
apiClient
.
post
(
'
/admin/ops/alert-silences
'
,
payload
)
}
// Email notification config
// Email notification config
export
async
function
getEmailNotificationConfig
():
Promise
<
EmailNotificationConfig
>
{
export
async
function
getEmailNotificationConfig
():
Promise
<
EmailNotificationConfig
>
{
const
{
data
}
=
await
apiClient
.
get
<
EmailNotificationConfig
>
(
'
/admin/ops/email-notification/config
'
)
const
{
data
}
=
await
apiClient
.
get
<
EmailNotificationConfig
>
(
'
/admin/ops/email-notification/config
'
)
...
@@ -1004,12 +1093,17 @@ export const opsAPI = {
...
@@ -1004,12 +1093,17 @@ export const opsAPI = {
listErrorLogs
,
listErrorLogs
,
getErrorLogDetail
,
getErrorLogDetail
,
retryErrorRequest
,
retryErrorRequest
,
listRetryAttempts
,
updateErrorResolved
,
listRequestDetails
,
listRequestDetails
,
listAlertRules
,
listAlertRules
,
createAlertRule
,
createAlertRule
,
updateAlertRule
,
updateAlertRule
,
deleteAlertRule
,
deleteAlertRule
,
listAlertEvents
,
listAlertEvents
,
getAlertEvent
,
updateAlertEventStatus
,
createAlertSilence
,
getEmailNotificationConfig
,
getEmailNotificationConfig
,
updateEmailNotificationConfig
,
updateEmailNotificationConfig
,
getAlertRuntimeSettings
,
getAlertRuntimeSettings
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment