Skip to content

Commit e9ed71f

Browse files
Merge branch 'resume-reprovide-cycle' into reprovide-sweep-enabled
2 parents f9ffda0 + ec0646a commit e9ed71f

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/ipfs/kubo
22

33
go 1.25
44

5-
replace github.com/libp2p/go-libp2p-kad-dht => ../go-libp2p-kad-dht
6-
75
require (
86
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc
97
contrib.go.opencensus.io/exporter/prometheus v0.4.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ github.com/libp2p/go-libp2p-gostream v0.6.0 h1:QfAiWeQRce6pqnYfmIVWJFXNdDyfiR/qk
518518
github.com/libp2p/go-libp2p-gostream v0.6.0/go.mod h1:Nywu0gYZwfj7Jc91PQvbGU8dIpqbQQkjWgDuOrFaRdA=
519519
github.com/libp2p/go-libp2p-http v0.5.0 h1:+x0AbLaUuLBArHubbbNRTsgWz0RjNTy6DJLOxQ3/QBc=
520520
github.com/libp2p/go-libp2p-http v0.5.0/go.mod h1:glh87nZ35XCQyFsdzZps6+F4HYI6DctVFY5u1fehwSg=
521+
github.com/libp2p/go-libp2p-kad-dht v0.35.2-0.20251024160545-decf9d8c2ed3 h1:s1r9HqCXtJeQxr8jinxXZFtW8zI7H9gDVUTreVnV9I0=
522+
github.com/libp2p/go-libp2p-kad-dht v0.35.2-0.20251024160545-decf9d8c2ed3/go.mod h1:aHMTg23iseX9grGSfA5gFUzLrqzmYbA8PqgGPqM8VkI=
521523
github.com/libp2p/go-libp2p-kbucket v0.3.1/go.mod h1:oyjT5O7tS9CQurok++ERgc46YLwEpuGoFq9ubvoUOio=
522524
github.com/libp2p/go-libp2p-kbucket v0.8.0 h1:QAK7RzKJpYe+EuSEATAaaHYMYLkPDGC18m9jxPLnU8s=
523525
github.com/libp2p/go-libp2p-kbucket v0.8.0/go.mod h1:JMlxqcEyKwO6ox716eyC0hmiduSWZZl6JY93mGaaqc4=

routing/delegated.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"errors"
77
"fmt"
88
"net/http"
9+
"path"
10+
"strings"
911

1012
drclient "github.com/ipfs/boxo/routing/http/client"
1113
"github.com/ipfs/boxo/routing/http/contentrouter"
@@ -24,6 +26,7 @@ import (
2426
"github.com/libp2p/go-libp2p/core/routing"
2527
ma "github.com/multiformats/go-multiaddr"
2628
"go.opencensus.io/stats/view"
29+
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
2730
)
2831

2932
var log = logging.Logger("routing/delegated")
@@ -187,8 +190,27 @@ func httpRoutingFromConfig(conf config.Router, extraHTTP *ExtraHTTPParams) (rout
187190

188191
delegateHTTPClient := &http.Client{
189192
Transport: &drclient.ResponseBodyLimitedTransport{
190-
RoundTripper: transport,
191-
LimitBytes: 1 << 20,
193+
RoundTripper: otelhttp.NewTransport(transport,
194+
otelhttp.WithSpanNameFormatter(func(operation string, req *http.Request) string {
195+
if req.Method == http.MethodGet {
196+
switch {
197+
case strings.HasPrefix(req.URL.Path, "/routing/v1/providers"):
198+
return "DelegatedHTTPClient.FindProviders"
199+
case strings.HasPrefix(req.URL.Path, "/routing/v1/peers"):
200+
return "DelegatedHTTPClient.FindPeers"
201+
case strings.HasPrefix(req.URL.Path, "/routing/v1/ipns"):
202+
return "DelegatedHTTPClient.GetIPNS"
203+
}
204+
} else if req.Method == http.MethodPut {
205+
switch {
206+
case strings.HasPrefix(req.URL.Path, "/routing/v1/ipns"):
207+
return "DelegatedHTTPClient.PutIPNS"
208+
}
209+
}
210+
return "DelegatedHTTPClient." + path.Dir(req.URL.Path)
211+
}),
212+
),
213+
LimitBytes: 1 << 20,
192214
},
193215
}
194216

0 commit comments

Comments
 (0)