Skip to content

Commit

Permalink
Merge pull request #1002 from libp2p/improve-tracing
Browse files Browse the repository at this point in the history
feat: add more attributes to traces
  • Loading branch information
guillaumemichel authored Nov 22, 2024
2 parents e8189b5 + 25e4aff commit 352305e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,12 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key multihash
if psTryAdd(p) {
select {
case peerOut <- p:
// Add tracing event for finding a provider
span.AddEvent("found provider", trace.WithAttributes(
attribute.Stringer("peer", p.ID),
attribute.Stringer("from", dht.self),
attribute.Int("provider_addrs_count", len(p.Addrs)),
attribute.Bool("found_in_provider_store", true),
))
case <-ctx.Done():
return
Expand Down Expand Up @@ -590,6 +593,7 @@ func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key multihash
span.AddEvent("found provider", trace.WithAttributes(
attribute.Stringer("peer", prov.ID),
attribute.Stringer("from", p),
attribute.Int("provider_addrs_count", len(prov.Addrs)),
))
case <-ctx.Done():
logger.Debug("context timed out sending more providers")
Expand Down

0 comments on commit 352305e

Please sign in to comment.