feat: add client-side metrics for routing-v1 client

This commit is contained in:
Gus Eggert 2023-03-27 14:58:12 -04:00
parent 60ba0b1821
commit 4c49967d9c
2 changed files with 10 additions and 0 deletions

View File

@ -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,

View File

@ -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")
})
}