Skip to content

Commit

Permalink
feat: add more attributes to traces
Browse files Browse the repository at this point in the history
  • Loading branch information
2color committed Nov 22, 2024
1 parent e8189b5 commit 25e4aff
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 25e4aff

Please sign in to comment.