feat: add client-side metrics for routing-v1 client
Gus Eggert committed
Mar 27, 2023 at 14:58 UTC
4c49967d9cb8c41f63740e763949e964cd260eca
2 files changed
+10
routing/delegated.go
+5
@@ -221,6 +221,11 @@ func httpRoutingFromConfig(conf config.Router, extraHTTP *ExtraHTTPParams) (rout
221
contentrouter.WithMaxProvideConcurrency(params.MaxProvideConcurrency),
222
)
223
224
+ err = view.Register(drclient.OpenCensusViews...)
225
+ if err != nil {
226
+ return nil, fmt.Errorf("registering HTTP delegated routing views: %w", err)
227
+ }
228
+
229
return &httpRoutingWrapper{
230
ContentRouting: cr,
231
ProvideManyRouter: cr,
test/cli/delegated_routing_http_test.go
+5
@@ -118,4 +118,9 @@ func TestHTTPDelegatedRouting(t *testing.T) {
118
assert.Equal(t, prov, res.Stdout.Trimmed())
119
})
120
121
+ t.Run("HTTP client should emit OpenCensus metrics", func(t *testing.T) {
122
+ resp := node.APIClient().Get("/debug/metrics/prometheus")
123
+ assert.Contains(t, resp.Body, "routing_http_client_length_count")
124
+ })
125
+
126
}