From f8872920608eadd974444fb956ad680f31caea20 Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Wed, 26 Apr 2023 09:26:58 +0200 Subject: [PATCH] feat(core): Add span for handle-new-signed-block in listener (#2093) Small span addition to listener --- core/listener.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/listener.go b/core/listener.go index 82b758a7fc..24d83cda12 100644 --- a/core/listener.go +++ b/core/listener.go @@ -8,6 +8,8 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/tendermint/tendermint/types" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" libhead "github.com/celestiaorg/go-header" @@ -16,6 +18,8 @@ import ( "github.com/celestiaorg/celestia-node/share/p2p/shrexsub" ) +var tracer = otel.Tracer("core/listener") + // Listener is responsible for listening to Core for // new block events and converting new Core blocks into // the main data structure used in the Celestia DA network: @@ -140,6 +144,11 @@ func (cl *Listener) listen(ctx context.Context, sub <-chan types.EventDataSigned } func (cl *Listener) handleNewSignedBlock(ctx context.Context, b types.EventDataSignedBlock) error { + ctx, span := tracer.Start(ctx, "handle-new-signed-block") + defer span.End() + span.SetAttributes( + attribute.Int64("height", b.Header.Height), + ) // extend block data eds, err := extendBlock(b.Data) if err != nil {