@ -9,6 +9,7 @@ import (
"github.com/go-kratos/kratos/v2/internal/endpoint"
"github.com/go-kratos/kratos/v2/internal/endpoint"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry"
"github.com/go-kratos/kratos/v2/registry"
"google.golang.org/grpc/attributes"
"google.golang.org/grpc/attributes"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver"
)
)
@ -22,6 +23,7 @@ type discoveryResolver struct {
cancel context . CancelFunc
cancel context . CancelFunc
insecure bool
insecure bool
debugLogDisabled bool
}
}
func ( r * discoveryResolver ) watch ( ) {
func ( r * discoveryResolver ) watch ( ) {
@ -77,8 +79,11 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
if err != nil {
if err != nil {
r . log . Errorf ( "[resolver] failed to update state: %s" , err )
r . log . Errorf ( "[resolver] failed to update state: %s" , err )
}
}
if ! r . debugLogDisabled {
b , _ := json . Marshal ( ins )
b , _ := json . Marshal ( ins )
r . log . Infof ( "[resolver] update instances: %s" , b )
r . log . Infof ( "[resolver] update instances: %s" , b )
}
}
}
func ( r * discoveryResolver ) Close ( ) {
func ( r * discoveryResolver ) Close ( ) {