Skip to content

Commit

Permalink
feat: adding spans to shrex getter (#2404)
Browse files Browse the repository at this point in the history
Self explanatory
  • Loading branch information
distractedm1nd committed Jun 27, 2023
1 parent 637072e commit 0267e21
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions share/getters/shrex.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import (
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/instrument/syncint64"
"go.opentelemetry.io/otel/metric/unit"
"go.opentelemetry.io/otel/trace"

"github.com/celestiaorg/nmt/namespace"
"github.com/celestiaorg/rsmt2d"

"github.com/celestiaorg/celestia-node/libs/utils"
"github.com/celestiaorg/celestia-node/share"
"github.com/celestiaorg/celestia-node/share/p2p"
"github.com/celestiaorg/celestia-node/share/p2p/peers"
Expand Down Expand Up @@ -128,6 +130,13 @@ func (sg *ShrexGetter) GetEDS(ctx context.Context, root *share.Root) (*rsmt2d.Ex
attempt int
err error
)
ctx, span := tracer.Start(ctx, "shrex/get-eds", trace.WithAttributes(
attribute.String("root", root.String()),
))
defer func() {
utils.SetStatusAndEnd(span, err)
}()

for {
if ctx.Err() != nil {
sg.metrics.recordEDSAttempt(ctx, attempt, false)
Expand Down Expand Up @@ -187,6 +196,13 @@ func (sg *ShrexGetter) GetSharesByNamespace(
attempt int
err error
)
ctx, span := tracer.Start(ctx, "shrex/get-shares-by-namespace", trace.WithAttributes(
attribute.String("root", root.String()),
attribute.String("nid", hex.EncodeToString(id)),
))
defer func() {
utils.SetStatusAndEnd(span, err)
}()

// verify that the namespace could exist inside the roots before starting network requests
roots := filterRootsByNamespace(root, id)
Expand Down

0 comments on commit 0267e21

Please sign in to comment.