diff --git a/swarm/network/fetcher.go b/swarm/network/fetcher.go index 6b21751669..3e6bb89045 100644 --- a/swarm/network/fetcher.go +++ b/swarm/network/fetcher.go @@ -18,12 +18,15 @@ package network import ( "context" + "fmt" "sync" "time" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/swarm/storage" + "github.com/ethereum/go-ethereum/swarm/tracing" + "github.com/opentracing/opentracing-go" ) const ( @@ -318,6 +321,14 @@ func (f *Fetcher) doRequest(gone chan *enode.ID, peersToSkip *sync.Map, sources gone <- sourceID case <-f.ctx.Done(): } + + // finish the request span + spanId := fmt.Sprintf("stream.send.request.%v.%v", *sourceID, req.Addr) + span := tracing.ShiftSpanByKey(spanId) + + if span != nil { + defer span.(opentracing.Span).Finish() + } }() return sources, nil }