swarm: tracing improvements

This commit is contained in:
Anton Evangelatov 2019-03-09 01:01:29 +01:00
parent 2cfe0bed9f
commit 0240a904b5
2 changed files with 11 additions and 0 deletions

View file

@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/swarm/tracing"
opentracing "github.com/opentracing/opentracing-go"
olog "github.com/opentracing/opentracing-go/log"
)
const (
@ -146,6 +147,8 @@ func (d *Delivery) handleRetrieveRequestMsg(ctx context.Context, sp *Peer, req *
ctx,
"stream.handle.retrieve")
osp.LogFields(olog.String("ref", req.Addr.String()))
s, err := sp.getServer(NewStream(swarmChunkServerStreamName, "", true))
if err != nil {
return err

View file

@ -102,6 +102,14 @@ func (n *NetStore) Get(rctx context.Context, ref Address) (Chunk, error) {
return nil, err
}
if chunk != nil {
// this is not measuring how long it takes to get the chunk for the localstore, but
// rather just adding a span for clarity when inspecting traces in Jaeger, in order
// to make it easier to reason which is the node that actually delivered a chunk.
_, sp := spancontext.StartSpan(
rctx,
"localstore.get")
defer sp.Finish()
return chunk, nil
}
return fetch(rctx)