diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 579e498a..25c6cb65 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -635,7 +635,7 @@ func setDefaults() { // Gateway viper.SetDefault("gateway.response_header_timeout", 600) // 600秒(10分钟)等待上游响应头,LLM高负载时可能排队较久 - viper.SetDefault("gateway.log_upstream_error_body", false) + viper.SetDefault("gateway.log_upstream_error_body", true) viper.SetDefault("gateway.log_upstream_error_body_max_bytes", 2048) viper.SetDefault("gateway.inject_beta_for_apikey", false) viper.SetDefault("gateway.failover_on_400", false) diff --git a/config.yaml b/config.yaml index 106de2c3..13e7977c 100644 --- a/config.yaml +++ b/config.yaml @@ -159,7 +159,7 @@ gateway: max_line_size: 41943040 # Log upstream error response body summary (safe/truncated; does not log request content) # 记录上游错误响应体摘要(安全/截断;不记录请求内容) - log_upstream_error_body: false + log_upstream_error_body: true # Max bytes to log from upstream error body # 记录上游错误响应体的最大字节数 log_upstream_error_body_max_bytes: 2048 diff --git a/deploy/config.example.yaml b/deploy/config.example.yaml index 87ff3148..7ca26968 100644 --- a/deploy/config.example.yaml +++ b/deploy/config.example.yaml @@ -159,7 +159,7 @@ gateway: max_line_size: 41943040 # Log upstream error response body summary (safe/truncated; does not log request content) # 记录上游错误响应体摘要(安全/截断;不记录请求内容) - log_upstream_error_body: false + log_upstream_error_body: true # Max bytes to log from upstream error body # 记录上游错误响应体的最大字节数 log_upstream_error_body_max_bytes: 2048 diff --git a/frontend/src/api/admin/ops.ts b/frontend/src/api/admin/ops.ts index 42b9e70d..3c39a32b 100644 --- a/frontend/src/api/admin/ops.ts +++ b/frontend/src/api/admin/ops.ts @@ -704,6 +704,12 @@ export interface OpsErrorDetail extends OpsErrorLog { error_body: string user_agent: string + // Upstream context (optional; enriched by gateway services) + upstream_status_code?: number | null + upstream_error_message?: string + upstream_error_detail?: string + upstream_errors?: string + auth_latency_ms?: number | null routing_latency_ms?: number | null upstream_latency_ms?: number | null diff --git a/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue b/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue index f8166040..0726bacd 100644 --- a/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue +++ b/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue @@ -177,6 +177,81 @@ + +
{{ prettyJSON(detail.upstream_error_detail) }}
+ {{ prettyJSON(ev.detail) }}
+ {{ prettyJSON(detail.upstream_errors) }}
+