mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
feat: add client-side metrics for routing-v1 client
This commit is contained in:
parent
60ba0b1821
commit
4c49967d9c
@ -221,6 +221,11 @@ func httpRoutingFromConfig(conf config.Router, extraHTTP *ExtraHTTPParams) (rout
|
||||
contentrouter.WithMaxProvideConcurrency(params.MaxProvideConcurrency),
|
||||
)
|
||||
|
||||
err = view.Register(drclient.OpenCensusViews...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("registering HTTP delegated routing views: %w", err)
|
||||
}
|
||||
|
||||
return &httpRoutingWrapper{
|
||||
ContentRouting: cr,
|
||||
ProvideManyRouter: cr,
|
||||
|
||||
@ -118,4 +118,9 @@ func TestHTTPDelegatedRouting(t *testing.T) {
|
||||
assert.Equal(t, prov, res.Stdout.Trimmed())
|
||||
})
|
||||
|
||||
t.Run("HTTP client should emit OpenCensus metrics", func(t *testing.T) {
|
||||
resp := node.APIClient().Get("/debug/metrics/prometheus")
|
||||
assert.Contains(t, resp.Body, "routing_http_client_length_count")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user