From 4db20918ff1b19d8f92ea5ffbf4311377567b47f 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 5584635dd39..d92e8f7c804 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 {