Skip to content

Commit 240adb1

Browse files
committed
debug: add log for flush duration
1 parent 692ed23 commit 240adb1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/remote/trans/default_server_handler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"net"
2424
"runtime/debug"
25+
"time"
2526

2627
"github.com/cloudwego/kitex/pkg/endpoint"
2728
"github.com/cloudwego/kitex/pkg/kerrors"
@@ -82,7 +83,11 @@ func (t *svrTransHandler) Write(ctx context.Context, conn net.Conn, sendMsg remo
8283
if err != nil {
8384
return ctx, err
8485
}
85-
return ctx, bufWriter.Flush()
86+
before := time.Now()
87+
err = bufWriter.Flush()
88+
duration := time.Now().Sub(before).Milliseconds()
89+
klog.CtxInfof(ctx, "[Debug Flush] size=%d, duration=%d\n", sendMsg.PayloadLen(), duration)
90+
return ctx, err
8691
}
8792

8893
// Read implements the remote.ServerTransHandler interface.

0 commit comments

Comments
 (0)