From 287c388c8c542f99629138efcfba488f5b6b03dd Mon Sep 17 00:00:00 2001 From: Jian Xiao Date: Tue, 21 May 2024 15:46:14 +0000 Subject: [PATCH] Add store chunk request deserialization latency to metric --- node/grpc/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/node/grpc/server.go b/node/grpc/server.go index 57a3b8e510..284edd1627 100644 --- a/node/grpc/server.go +++ b/node/grpc/server.go @@ -131,6 +131,8 @@ func (s *Server) serveRetrieval() error { } func (s *Server) handleStoreChunksRequest(ctx context.Context, in *pb.StoreChunksRequest) (*pb.StoreChunksReply, error) { + start := time.Now() + // Get batch header hash batchHeader, err := GetBatchHeader(in) if err != nil { @@ -142,6 +144,9 @@ func (s *Server) handleStoreChunksRequest(ctx context.Context, in *pb.StoreChunk return nil, err } + s.node.Metrics.ObserveLatency("StoreChunks", "deserialization", float64(time.Since(start).Milliseconds())) + s.node.Logger.Info("StoreChunksRequest deserialized", "duration", time.Since(start)) + sig, err := s.node.ProcessBatch(ctx, batchHeader, blobs, in.GetBlobs()) if err != nil { return nil, err