Skip to content

Commit

Permalink
Add log for request data size breakdown (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Jun 14, 2024
1 parent 7d77786 commit 1438b4b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion node/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,16 @@ func (s *Server) validateStoreChunkRequest(in *pb.StoreChunksRequest) error {
func (s *Server) StoreChunks(ctx context.Context, in *pb.StoreChunksRequest) (*pb.StoreChunksReply, error) {
start := time.Now()

s.node.Logger.Info("StoreChunks RPC request recieved", "request message size", proto.Size(in))
blobHeadersSize := 0
bundleSize := 0
for _, blob := range in.Blobs {
blobHeadersSize += proto.Size(blob.GetHeader())
for _, bundle := range blob.GetBundles() {
bundleSize += proto.Size(bundle)
}
}
// Caveat: proto.Size() returns int, so this log will not work for larger protobuf message (over about 2GiB).
s.node.Logger.Info("StoreChunks RPC request recieved", "num of blobs", len(in.Blobs), "request message size", proto.Size(in), "total size of blob headers", blobHeadersSize, "total size of bundles", bundleSize)

// Validate the request.
if err := s.validateStoreChunkRequest(in); err != nil {
Expand Down

0 comments on commit 1438b4b

Please sign in to comment.