diff options
author | John Cai <jcai@gitlab.com> | 2023-08-22 20:33:31 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2023-08-22 20:33:31 +0300 |
commit | cd40480a3e12cb1c9c49349237afa25fb2153ffb (patch) | |
tree | 29e686df60098237acff46344fac4480db5b0395 | |
parent | cc214cd7a519cd09c8befa45cf2f4e957562b906 (diff) |
debugging purposesjc/test-data-transfer-bytes
-rw-r--r-- | internal/gitaly/service/ssh/upload_pack.go | 1 | ||||
-rw-r--r-- | internal/helper/count.go | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/internal/gitaly/service/ssh/upload_pack.go b/internal/gitaly/service/ssh/upload_pack.go index ec1656566..c11fb7b3c 100644 --- a/internal/gitaly/service/ssh/upload_pack.go +++ b/internal/gitaly/service/ssh/upload_pack.go @@ -181,6 +181,7 @@ func (s *server) sshUploadPack(rpcContext context.Context, req sshUploadPackRequ ctxlogrus.Extract(ctx).WithField("response_bytes", stdoutCounter.N).Info("request details") + fmt.Println(stdoutCounter.String()) return nil, stdoutCounter.N, 0, nil } diff --git a/internal/helper/count.go b/internal/helper/count.go index c5b7c419b..77f1c94c9 100644 --- a/internal/helper/count.go +++ b/internal/helper/count.go @@ -1,16 +1,25 @@ package helper -import "io" +import ( + "bytes" + "io" +) // CountingWriter wraps an io.Writer and counts all the writes. Accessing // the count N is not thread-safe. type CountingWriter struct { W io.Writer N int64 + b bytes.Buffer } func (cw *CountingWriter) Write(p []byte) (int, error) { n, err := cw.W.Write(p) cw.N += int64(n) + cw.b.Write(p) return n, err } + +func (cw *CountingWriter) String() string { + return cw.b.String() +} |