Skip to content

Commit 352305e

Browse files
Merge pull request #1002 from libp2p/improve-tracing
feat: add more attributes to traces
2 parents e8189b5 + 25e4aff commit 352305e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routing.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,12 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key multihash
547547
if psTryAdd(p) {
548548
select {
549549
case peerOut <- p:
550+
// Add tracing event for finding a provider
550551
span.AddEvent("found provider", trace.WithAttributes(
551552
attribute.Stringer("peer", p.ID),
552553
attribute.Stringer("from", dht.self),
554+
attribute.Int("provider_addrs_count", len(p.Addrs)),
555+
attribute.Bool("found_in_provider_store", true),
553556
))
554557
case <-ctx.Done():
555558
return
@@ -590,6 +593,7 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key multihash
590593
span.AddEvent("found provider", trace.WithAttributes(
591594
attribute.Stringer("peer", prov.ID),
592595
attribute.Stringer("from", p),
596+
attribute.Int("provider_addrs_count", len(prov.Addrs)),
593597
))
594598
case <-ctx.Done():
595599
logger.Debug("context timed out sending more providers")

0 commit comments

Comments
 (0)