From 5a133ff2d44816a3ae6611ee8f62096d8d8997ad Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Thu, 11 Aug 2022 15:56:48 -0700 Subject: [PATCH] Hook up resource manager metrics --- metrics/metrics.go | 2 ++ node/modules/lp2p/rcmgr.go | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/metrics/metrics.go b/metrics/metrics.go index 8a4c3aa31..18c996b01 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -9,6 +9,7 @@ import ( "go.opencensus.io/tag" rpcmetrics "github.com/filecoin-project/go-jsonrpc/metrics" + "github.com/libp2p/go-libp2p-resource-manager/obs" "github.com/filecoin-project/lotus/blockstore" ) @@ -645,6 +646,7 @@ var DefaultViews = func() []*view.View { } views = append(views, blockstore.DefaultViews...) views = append(views, rpcmetrics.DefaultViews...) + views = append(views, obs.DefaultViews...) return views }() diff --git a/node/modules/lp2p/rcmgr.go b/node/modules/lp2p/rcmgr.go index 6c8c8c3ab..6725b869c 100644 --- a/node/modules/lp2p/rcmgr.go +++ b/node/modules/lp2p/rcmgr.go @@ -8,7 +8,6 @@ import ( "os" "path/filepath" - ocprom "contrib.go.opencensus.io/exporter/prometheus" logging "github.com/ipfs/go-log/v2" "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p-core/network" @@ -16,9 +15,7 @@ import ( "github.com/libp2p/go-libp2p-core/protocol" rcmgr "github.com/libp2p/go-libp2p-resource-manager" rcmgrObs "github.com/libp2p/go-libp2p-resource-manager/obs" - "github.com/prometheus/client_golang/prometheus" "go.opencensus.io/stats" - "go.opencensus.io/stats/view" "go.opencensus.io/tag" "go.uber.org/fx" @@ -130,19 +127,6 @@ func ResourceManager(connMgrHi uint) func(lc fx.Lifecycle, repo repo.LockedRepo) return nil, fmt.Errorf("error creating resource manager: %w", err) } - // Hook up resource manager metrics - err = view.Register(rcmgrObs.DefaultViews...) - if err != nil { - return nil, fmt.Errorf("error registering metrics: %w", err) - } - _, err = ocprom.NewExporter(ocprom.Options{ - Registry: prometheus.DefaultRegisterer.(*prometheus.Registry), - Namespace: "rcmgr_trace_metrics", - }) - if err != nil { - return nil, fmt.Errorf("error registering metrics: %w", err) - } - lc.Append(fx.Hook{ OnStop: func(_ context.Context) error { return mgr.Close()