From e8df8b3df76604778fbfde0ee6badddfab7e99b5 Mon Sep 17 00:00:00 2001 From: Alexandros Filios Date: Thu, 19 Dec 2024 17:18:12 +0100 Subject: [PATCH] Logging Signed-off-by: Alexandros Filios --- platform/fabric/core/generic/committer/committer.go | 1 + platform/fabric/core/generic/delivery/delivery.go | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/fabric/core/generic/committer/committer.go b/platform/fabric/core/generic/committer/committer.go index 966e9b838..a59e209c0 100644 --- a/platform/fabric/core/generic/committer/committer.go +++ b/platform/fabric/core/generic/committer/committer.go @@ -358,6 +358,7 @@ func (c *Committer) CommitConfig(blockNumber uint64, raw []byte, env *common.Env // Commit commits the transactions in the block passed as argument func (c *Committer) Commit(ctx context.Context, block *common.Block) error { + logger.Infof("Received block [%d] in committer", block.Header.Number) newCtx, span := c.metrics.Commits.Start(ctx, "commit_block") defer span.End() diff --git a/platform/fabric/core/generic/delivery/delivery.go b/platform/fabric/core/generic/delivery/delivery.go index f689d21e3..59298b6ce 100644 --- a/platform/fabric/core/generic/delivery/delivery.go +++ b/platform/fabric/core/generic/delivery/delivery.go @@ -131,11 +131,14 @@ func (d *Delivery) Run(ctx context.Context) error { var err error waitTime := d.channelConfig.DeliverySleepAfterFailure() for { + logger.Infof("Delivery service new iteration") select { case <-d.stop: + logger.Infof("Stop delivery run") // Time to stop return nil case <-ctx.Done(): + logger.Infof("Context of delivery canceled") // Time to cancel return errors.New("context done") default: @@ -161,6 +164,7 @@ func (d *Delivery) Run(ctx context.Context) error { span.AddEvent("wait_message") resp, err := df.Recv() + logger.Infof("Delivery service received response of type [%v]", resp.Type) span.AddEvent("received_message") if err != nil { df = nil @@ -176,17 +180,14 @@ func (d *Delivery) Run(ctx context.Context) error { case *pb.DeliverResponse_Block: span.SetAttributes(tracing.String(messageTypeLabel, block)) if r.Block == nil || r.Block.Data == nil || r.Block.Header == nil || r.Block.Metadata == nil { - if logger.IsEnabledFor(zapcore.DebugLevel) { - logger.Debugf("deliver service [%s:%s:%s], received nil block", d.client.Address(), d.NetworkName, d.channel) - } + logger.Infof("deliver service [%s:%s:%s], received nil block", d.client.Address(), d.NetworkName, d.channel) span.RecordError(errors.New("nil block")) time.Sleep(waitTime) df = nil } - if logger.IsEnabledFor(zapcore.DebugLevel) { - logger.Debugf("delivery service [%s:%s:%s], commit block [%d]", d.client.Address(), d.NetworkName, d.channel, r.Block.Header.Number) - } + logger.Infof("delivery service [%s:%s:%s], commit block [%d]", d.client.Address(), d.NetworkName, d.channel, r.Block.Header.Number) + d.lastBlockReceived = r.Block.Header.Number span.AddEvent("invoke_callback")