Skip to content

Commit

Permalink
feat(core): Add span for handle-new-signed-block in listener (celesti…
Browse files Browse the repository at this point in the history
…aorg#2093)

Small span addition to listener
  • Loading branch information
renaynay authored Apr 26, 2023
1 parent 82fbba8 commit f887292
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f887292

Please sign in to comment.