diff --git a/internal/client/v1/client/discoverer/discover.go b/internal/client/v1/client/discoverer/discover.go index e287377196..ebb6848f7e 100644 --- a/internal/client/v1/client/discoverer/discover.go +++ b/internal/client/v1/client/discoverer/discover.go @@ -304,20 +304,21 @@ func (c *client) discoverAddrs(ctx context.Context, nodes *payload.Info_Nodes, e case <-ctx.Done(): return nil, ctx.Err() default: - if node != nil && node.GetPods() != nil && len(node.GetPods().GetPods()) > i { + if node != nil && + node.GetPods() != nil && + len(node.GetPods().GetPods()) > i && + len(node.GetPods().GetPods()[i].GetIp()) != 0 { addr := net.JoinHostPort(node.GetPods().GetPods()[i].GetIp(), uint16(c.port)) if err = c.connect(ctx, addr); err != nil { - err = errors.ErrAddrCouldNotDiscover(err, addr) select { case <-ctx.Done(): return nil, ctx.Err() - case ech <- err: + case ech <- errors.ErrAddrCouldNotDiscover(err, addr): } err = nil } else { addrs = append(addrs, addr) } - break } } } diff --git a/internal/net/grpc/errdetails/errdetails.go b/internal/net/grpc/errdetails/errdetails.go index c22c2febae..500e1b52de 100644 --- a/internal/net/grpc/errdetails/errdetails.go +++ b/internal/net/grpc/errdetails/errdetails.go @@ -277,22 +277,29 @@ func AnyToErrorDetail(a *types.Any) proto.Message { func DebugInfoFromInfoDetail(v *info.Detail) *DebugInfo { debug := &DebugInfo{ - Detail: "Version: " + v.Version + ", " + - "Name: " + v.ServerName + ", " + - "GitCommit: " + v.GitCommit + ", " + - "BuildTime: " + v.BuildTime + ", " + - "NGT_Version: " + v.NGTVersion + ", " + - "Go_Version: " + v.GoVersion + ", " + - "GOARCH: " + v.GoArch + ", " + - "GOOS: " + v.GoOS + ", " + - "CGO_Enabled: " + v.CGOEnabled + ", " + - "BuildCPUInfo: [" + strings.Join(v.BuildCPUInfoFlags, ", ") + "]", + Detail: strings.Join(append(append([]string{ + "Version:", v.Version, ",", + "Name:", v.ServerName, ",", + "GitCommit:", v.GitCommit, ",", + "BuildTime:", v.BuildTime, ",", + "NGT_Version:", v.NGTVersion, ",", + "Go_Version:", v.GoVersion, ",", + "GOARCH:", v.GoArch, ",", + "GOOS:", v.GoOS, ",", + "CGO_Enabled:", v.CGOEnabled, ",", + "BuildCPUInfo: [", + }, v.BuildCPUInfoFlags...), "]"), " "), } if debug.GetStackEntries() == nil { debug.StackEntries = make([]string, 0, len(v.StackTrace)) } for i, stack := range v.StackTrace { - debug.StackEntries = append(debug.GetStackEntries(), "id: "+strconv.Itoa(i)+" stack_trace: "+stack.String()) + debug.StackEntries = append(debug.GetStackEntries(), strings.Join([]string{ + "id:", + strconv.Itoa(i), + "stack_trace:", + stack.String(), + }, " ")) } return debug }