"git@web.lueluesay.top:chenxi/sub2api.git" did not exist on "29c406dda0505b69b4720e00ac6aa9b56dc61029"
Unverified Commit 20544a44 authored by Wesley Liddick's avatar Wesley Liddick Committed by GitHub
Browse files

Merge pull request #1300 from xilu0/fix/forward-failed-log-missing-account-proxy-info

fix: add account and proxy details to forward_failed log
parents b688ebee 7c6dc9dd
...@@ -422,11 +422,24 @@ func (h *GatewayHandler) Messages(c *gin.Context) { ...@@ -422,11 +422,24 @@ func (h *GatewayHandler) Messages(c *gin.Context) {
} }
} }
wroteFallback := h.ensureForwardErrorResponse(c, streamStarted) wroteFallback := h.ensureForwardErrorResponse(c, streamStarted)
reqLog.Error("gateway.forward_failed", forwardFailedFields := []zap.Field{
zap.Int64("account_id", account.ID), zap.Int64("account_id", account.ID),
zap.String("account_name", account.Name),
zap.String("account_platform", account.Platform),
zap.Bool("fallback_error_response_written", wroteFallback), zap.Bool("fallback_error_response_written", wroteFallback),
zap.Error(err), zap.Error(err),
) }
if account.Proxy != nil {
forwardFailedFields = append(forwardFailedFields,
zap.Int64("proxy_id", account.Proxy.ID),
zap.String("proxy_name", account.Proxy.Name),
zap.String("proxy_host", account.Proxy.Host),
zap.Int("proxy_port", account.Proxy.Port),
)
} else if account.ProxyID != nil {
forwardFailedFields = append(forwardFailedFields, zap.Int64p("proxy_id", account.ProxyID))
}
reqLog.Error("gateway.forward_failed", forwardFailedFields...)
return return
} }
...@@ -741,11 +754,24 @@ func (h *GatewayHandler) Messages(c *gin.Context) { ...@@ -741,11 +754,24 @@ func (h *GatewayHandler) Messages(c *gin.Context) {
} }
} }
wroteFallback := h.ensureForwardErrorResponse(c, streamStarted) wroteFallback := h.ensureForwardErrorResponse(c, streamStarted)
reqLog.Error("gateway.forward_failed", forwardFailedFields := []zap.Field{
zap.Int64("account_id", account.ID), zap.Int64("account_id", account.ID),
zap.String("account_name", account.Name),
zap.String("account_platform", account.Platform),
zap.Bool("fallback_error_response_written", wroteFallback), zap.Bool("fallback_error_response_written", wroteFallback),
zap.Error(err), zap.Error(err),
) }
if account.Proxy != nil {
forwardFailedFields = append(forwardFailedFields,
zap.Int64("proxy_id", account.Proxy.ID),
zap.String("proxy_name", account.Proxy.Name),
zap.String("proxy_host", account.Proxy.Host),
zap.Int("proxy_port", account.Proxy.Port),
)
} else if account.ProxyID != nil {
forwardFailedFields = append(forwardFailedFields, zap.Int64p("proxy_id", account.ProxyID))
}
reqLog.Error("gateway.forward_failed", forwardFailedFields...)
return return
} }
......
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