zouyx commented on a change in pull request #1092:
URL: https://github.com/apache/dubbo-go/pull/1092#discussion_r602824479



##########
File path: test/integrate/dubbo/go-server/go.mod
##########
@@ -1,3 +1,7 @@
 module github.com/apache/dubbo-go/test/integrate/dubbo/go-server
 
 go 1.13
+
+require (

Review comment:
       remove this block pls

##########
File path: protocol/grpc/client.go
##########
@@ -90,20 +91,29 @@ type Client struct {
 }
 
 // NewClient creates a new gRPC client.
-func NewClient(url *common.URL) *Client {
+func NewClient(url *common.URL) (*Client, error) {
        // if global trace instance was set , it means trace function enabled. 
If not , will return Nooptracer
        tracer := opentracing.GlobalTracer()
        dialOpts := make([]grpc.DialOption, 0, 4)
        maxMessageSize, _ := 
strconv.Atoi(url.GetParam(constant.MESSAGE_SIZE_KEY, "4"))
-       dialOpts = append(dialOpts, grpc.WithInsecure(), grpc.WithBlock(), 
grpc.WithUnaryInterceptor(
+
+       //consumer config client connectTimeout
+       connectTimeout := config.GetConsumerConfig().ConnectTimeout
+
+       dialOpts = append(dialOpts, grpc.WithInsecure(), grpc.WithBlock(), 
grpc.WithTimeout(connectTimeout), grpc.WithUnaryInterceptor(
                otgrpc.OpenTracingClientInterceptor(tracer, 
otgrpc.LogPayloads())),
                grpc.WithDefaultCallOptions(
                        grpc.CallContentSubtype(clientConf.ContentSubType),
                        grpc.MaxCallRecvMsgSize(1024*1024*maxMessageSize),
                        grpc.MaxCallSendMsgSize(1024*1024*maxMessageSize)))
+
+       logger.Infof("begin grpc dail:%s, begin time: %s ", url, 
time.Now().Format("2006-01-02 15:04:05.000"))

Review comment:
       you can use tracing for process time around the request,why do you add 
this log?

##########
File path: protocol/grpc/client.go
##########
@@ -90,20 +91,29 @@ type Client struct {
 }
 
 // NewClient creates a new gRPC client.
-func NewClient(url *common.URL) *Client {
+func NewClient(url *common.URL) (*Client, error) {
        // if global trace instance was set , it means trace function enabled. 
If not , will return Nooptracer
        tracer := opentracing.GlobalTracer()
        dialOpts := make([]grpc.DialOption, 0, 4)
        maxMessageSize, _ := 
strconv.Atoi(url.GetParam(constant.MESSAGE_SIZE_KEY, "4"))
-       dialOpts = append(dialOpts, grpc.WithInsecure(), grpc.WithBlock(), 
grpc.WithUnaryInterceptor(
+
+       //consumer config client connectTimeout
+       connectTimeout := config.GetConsumerConfig().ConnectTimeout
+
+       dialOpts = append(dialOpts, grpc.WithInsecure(), grpc.WithBlock(), 
grpc.WithTimeout(connectTimeout), grpc.WithUnaryInterceptor(
                otgrpc.OpenTracingClientInterceptor(tracer, 
otgrpc.LogPayloads())),
                grpc.WithDefaultCallOptions(
                        grpc.CallContentSubtype(clientConf.ContentSubType),
                        grpc.MaxCallRecvMsgSize(1024*1024*maxMessageSize),
                        grpc.MaxCallSendMsgSize(1024*1024*maxMessageSize)))
+
+       logger.Infof("begin grpc dail:%s, begin time: %s ", url, 
time.Now().Format("2006-01-02 15:04:05.000"))

Review comment:
       you can use tracing for process time around the request,why do you add 
this log?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to