fix(openai): include proxy host in upstream_failover_switching logs
Enrich openai.upstream_failover_switching structured logs with proxy identity fields (proxy_id, proxy_name, proxy_host, proxy_port) so operators can see which outbound proxy failed when switching accounts. Matches the existing gateway.forward_failed / websocket_proxy_failed logging pattern.
This commit is contained in:
1 parent
da85cc7e47
commit
ba5b6970be
1 file changed
+13
-2
@@ -479,12 +479,23 @@ func (h *OpenAIGatewayHandler) Responses(c *gin.Context) {
|
||||
h.handleFailoverExhausted(c, failoverErr, streamStarted)
|
||||
return
|
||||
}
|
||||
reqLog.Warn("openai.upstream_failover_switching",
|
||||
failoverSwitchFields := []zap.Field{
|
||||
zap.Int64("account_id", account.ID),
|
||||
zap.Int("upstream_status", failoverErr.StatusCode),
|
||||
zap.Int("switch_count", switchCount),
|
||||
zap.Int("max_switches", maxAccountSwitches),
|
||||
)
|
||||
}
|
||||
if account.Proxy != nil {
|
||||
failoverSwitchFields = append(failoverSwitchFields,
|
||||
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 {
|
||||
failoverSwitchFields = append(failoverSwitchFields, zap.Int64p("proxy_id", account.ProxyID))
|
||||
}
|
||||
reqLog.Warn("openai.upstream_failover_switching", failoverSwitchFields...)
|
||||
continue
|
||||
}
|
||||
h.gatewayService.ReportOpenAIAccountScheduleResult(account.ID, false, nil)
|
||||
|
||||
Reference in new issue
Block a user