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
9e6cd36a
Commit
9e6cd36a
authored
Jan 14, 2026
by
IanShaw027
Browse files
feat(ops): 添加上游响应体字段到错误事件
- 在 OpsUpstreamErrorEvent 中添加 UpstreamResponseBody 字段 - 用于存储上游服务返回的响应内容 - 区分客户端响应和上游响应
parent
f25f992a
Changes
1
Show whitespace changes
Inline
Side-by-side
backend/internal/service/ops_upstream_context.go
View file @
9e6cd36a
...
@@ -55,6 +55,9 @@ type OpsUpstreamErrorEvent struct {
...
@@ -55,6 +55,9 @@ type OpsUpstreamErrorEvent struct {
// Required for retrying a specific upstream attempt.
// Required for retrying a specific upstream attempt.
UpstreamRequestBody
string
`json:"upstream_request_body,omitempty"`
UpstreamRequestBody
string
`json:"upstream_request_body,omitempty"`
// Best-effort upstream response capture (sanitized+trimmed).
UpstreamResponseBody
string
`json:"upstream_response_body,omitempty"`
// Kind: http_error | request_error | retry_exhausted | failover
// Kind: http_error | request_error | retry_exhausted | failover
Kind
string
`json:"kind,omitempty"`
Kind
string
`json:"kind,omitempty"`
...
@@ -72,6 +75,7 @@ func appendOpsUpstreamError(c *gin.Context, ev OpsUpstreamErrorEvent) {
...
@@ -72,6 +75,7 @@ func appendOpsUpstreamError(c *gin.Context, ev OpsUpstreamErrorEvent) {
ev
.
Platform
=
strings
.
TrimSpace
(
ev
.
Platform
)
ev
.
Platform
=
strings
.
TrimSpace
(
ev
.
Platform
)
ev
.
UpstreamRequestID
=
strings
.
TrimSpace
(
ev
.
UpstreamRequestID
)
ev
.
UpstreamRequestID
=
strings
.
TrimSpace
(
ev
.
UpstreamRequestID
)
ev
.
UpstreamRequestBody
=
strings
.
TrimSpace
(
ev
.
UpstreamRequestBody
)
ev
.
UpstreamRequestBody
=
strings
.
TrimSpace
(
ev
.
UpstreamRequestBody
)
ev
.
UpstreamResponseBody
=
strings
.
TrimSpace
(
ev
.
UpstreamResponseBody
)
ev
.
Kind
=
strings
.
TrimSpace
(
ev
.
Kind
)
ev
.
Kind
=
strings
.
TrimSpace
(
ev
.
Kind
)
ev
.
Message
=
strings
.
TrimSpace
(
ev
.
Message
)
ev
.
Message
=
strings
.
TrimSpace
(
ev
.
Message
)
ev
.
Detail
=
strings
.
TrimSpace
(
ev
.
Detail
)
ev
.
Detail
=
strings
.
TrimSpace
(
ev
.
Detail
)
...
...
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