From 1524fc9b6088661127dc8762e87fb0884ff3af98 Mon Sep 17 00:00:00 2001 From: Yacov Manevich Date: Thu, 18 Feb 2021 18:31:03 +0200 Subject: [PATCH] Log stream total lifetime This commit simply logs the duration of the total lifetime of a stream Change-Id: Id392610aaf4ab4ec81c549ea87c6bf1b240be39f Signed-off-by: Yacov Manevich (cherry picked from commit db0a8647ed249a440955485119a8583adbf921fe) --- orderer/common/cluster/comm.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/orderer/common/cluster/comm.go b/orderer/common/cluster/comm.go index 67e4b0a9ce4..4a1f71b8fc7 100644 --- a/orderer/common/cluster/comm.go +++ b/orderer/common/cluster/comm.go @@ -555,7 +555,13 @@ func (stream *Stream) sendMessage(request *orderer.StepRequest) { } func (stream *Stream) serviceStream() { - defer stream.Cancel(errAborted) + streamStartTime := time.Now() + defer func() { + stream.Logger.Debugf("Stream %d to (%s) terminating at total lifetime of %s", + stream.ID, stream.Endpoint, time.Since(streamStartTime)) + + stream.Cancel(errAborted) + }() for { select {