mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm: tracing improvements
This commit is contained in:
parent
2cfe0bed9f
commit
0240a904b5
2 changed files with 11 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/swarm/storage"
|
"github.com/ethereum/go-ethereum/swarm/storage"
|
||||||
"github.com/ethereum/go-ethereum/swarm/tracing"
|
"github.com/ethereum/go-ethereum/swarm/tracing"
|
||||||
opentracing "github.com/opentracing/opentracing-go"
|
opentracing "github.com/opentracing/opentracing-go"
|
||||||
|
olog "github.com/opentracing/opentracing-go/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -146,6 +147,8 @@ func (d *Delivery) handleRetrieveRequestMsg(ctx context.Context, sp *Peer, req *
|
||||||
ctx,
|
ctx,
|
||||||
"stream.handle.retrieve")
|
"stream.handle.retrieve")
|
||||||
|
|
||||||
|
osp.LogFields(olog.String("ref", req.Addr.String()))
|
||||||
|
|
||||||
s, err := sp.getServer(NewStream(swarmChunkServerStreamName, "", true))
|
s, err := sp.getServer(NewStream(swarmChunkServerStreamName, "", true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,14 @@ func (n *NetStore) Get(rctx context.Context, ref Address) (Chunk, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if chunk != nil {
|
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 chunk, nil
|
||||||
}
|
}
|
||||||
return fetch(rctx)
|
return fetch(rctx)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue