You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to get some registered services,but the program throwed error about: instance list is empty!
invoking like this:
registry.Discovery.GetService(ctx, "myservice")
What you expected to happen:
no error
How to reproduce it (as minimally and precisely as possible):
Just call registryDiscovery.GetService()
Anything else we need to know?:
The nacos implementation of discovery interface use nacos-sdk-go mothed: SelectInstances
source code:
(github.com/nacos-group/nacos-sdk-go/clients/naming_client)
// GetService return the service instances in memory according to the service name.
func (r *Registry) GetService(_ context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
res, err := r.cli.SelectInstances(vo.SelectInstancesParam{
ServiceName: serviceName,
HealthyOnly: true,
})
if err != nil {
return nil, err
}
items := make([]*registry.ServiceInstance, 0, len(res))
for _, in := range res {
kind := r.opts.kind
if k, ok := in.Metadata["kind"]; ok {
kind = k
}
items = append(items, ®istry.ServiceInstance{
ID: in.InstanceId,
Name: in.ServiceName,
Version: in.Metadata["version"],
Metadata: in.Metadata,
Endpoints: []string{fmt.Sprintf("%s://%s:%d", kind, in.Ip, in.Port)},
})
}
return items, nil
}
if the param.GroupName is empty, value is DEFAULT_GROUP.But the GetService() can`t pass the GroupName.My service group name is customized,so no value obtained.
Environment:
Kratos version (use kratos -v): v2.1.2
Go version (use go version): v1.16.0
OS (e.g: cat /etc/os-release): windows
Others:
kratos/contrib/registry/nacos/v2 version is v2.0.0
The text was updated successfully, but these errors were encountered:
What happened:
I want to get some registered services,but the program throwed error about: instance list is empty!
invoking like this:
What you expected to happen:
no error
How to reproduce it (as minimally and precisely as possible):
Just call registryDiscovery.GetService()
Anything else we need to know?:
The nacos implementation of discovery interface use nacos-sdk-go mothed: SelectInstances
source code:
(github.com/nacos-group/nacos-sdk-go/clients/naming_client)
(kratos/contrib/registry/nacos/v2)
if the param.GroupName is empty, value is DEFAULT_GROUP.But the GetService() can`t pass the GroupName.My service group name is customized,so no value obtained.
Environment:
kratos -v
): v2.1.2go version
): v1.16.0cat /etc/os-release
): windowskratos/contrib/registry/nacos/v2 version is v2.0.0
The text was updated successfully, but these errors were encountered: