diff --git a/cmd/waku/node.go b/cmd/waku/node.go index ccfbd3b8..805c1999 100644 --- a/cmd/waku/node.go +++ b/cmd/waku/node.go @@ -16,10 +16,10 @@ import ( rcmgr "github.com/libp2p/go-libp2p/p2p/host/resource-manager" "github.com/pbnjay/memory" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/waku/persistence/sqlite" dbutils "github.com/waku-org/go-waku/waku/persistence/utils" - wmetrics "github.com/waku-org/go-waku/waku/v2/metrics" wakupeerstore "github.com/waku-org/go-waku/waku/v2/peerstore" "github.com/waku-org/go-waku/waku/v2/rendezvous" @@ -110,7 +110,6 @@ func Execute(options NodeOptions) { if options.Metrics.Enable { metricsServer = metrics.NewMetricsServer(options.Metrics.Address, options.Metrics.Port, logger) go metricsServer.Start() - wmetrics.RecordVersion(ctx, node.Version, node.GitCommit) } lvl, err := zapcore.ParseLevel(options.LogLevel) @@ -125,6 +124,7 @@ func Execute(options NodeOptions) { node.WithHostAddress(hostAddr), node.WithKeepAlive(options.KeepAlive), node.WithMaxPeerConnections(options.MaxPeerConnections), + node.WithPrometheusRegisterer(prometheus.DefaultRegisterer), } if len(options.AdvertiseAddresses) != 0 { nodeOpts = append(nodeOpts, node.WithAdvertiseAddresses(options.AdvertiseAddresses...)) @@ -144,6 +144,8 @@ func Execute(options NodeOptions) { libp2pOpts := node.DefaultLibP2POptions + libp2pOpts = append(libp2pOpts, libp2p.PrometheusRegisterer(prometheus.DefaultRegisterer)) + memPerc := scalePerc(options.ResourceScalingMemoryPercent) fdPerc := scalePerc(options.ResourceScalingFDPercent) limits := rcmgr.DefaultLimits // Default memory limit: 1/8th of total memory, minimum 128MB, maximum 1GB @@ -223,7 +225,7 @@ func Execute(options NodeOptions) { dbOptions = append(dbOptions, persistence.WithMigrations(migrationFn)) // TODO: refactor migrations out of DBStore, or merge DBStore with rendezvous DB } - dbStore, err = persistence.NewDBStore(logger, dbOptions...) + dbStore, err = persistence.NewDBStore(prometheus.DefaultRegisterer, logger, dbOptions...) failOnErr(err, "DBStore") nodeOpts = append(nodeOpts, node.WithMessageProvider(dbStore)) } diff --git a/cmd/waku/rest/utils_test.go b/cmd/waku/rest/utils_test.go index 485519d0..7f3f5a02 100644 --- a/cmd/waku/rest/utils_test.go +++ b/cmd/waku/rest/utils_test.go @@ -4,6 +4,7 @@ import ( "database/sql" "testing" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/waku/persistence" "github.com/waku-org/go-waku/waku/persistence/sqlite" @@ -15,7 +16,7 @@ func MemoryDB(t *testing.T) *persistence.DBStore { db, err := sqlite.NewDB(":memory:", false, utils.Logger()) require.NoError(t, err) - dbStore, err := persistence.NewDBStore(utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) + dbStore, err := persistence.NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) require.NoError(t, err) return dbStore diff --git a/cmd/waku/rpc/admin_test.go b/cmd/waku/rpc/admin_test.go index c23d78f9..41966e6f 100644 --- a/cmd/waku/rpc/admin_test.go +++ b/cmd/waku/rpc/admin_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" @@ -34,7 +35,7 @@ func TestV1Peers(t *testing.T) { host, err := tests.MakeHost(context.Background(), port, rand.Reader) require.NoError(t, err) - relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.Background()) require.NoError(t, err) diff --git a/cmd/waku/rpc/filter_test.go b/cmd/waku/rpc/filter_test.go index 0ea6d4eb..202cc113 100644 --- a/cmd/waku/rpc/filter_test.go +++ b/cmd/waku/rpc/filter_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/node" @@ -56,7 +57,7 @@ func TestFilterSubscription(t *testing.T) { b := relay.NewBroadcaster(10) require.NoError(t, b.Start(context.Background())) - node := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), utils.Logger()) + node := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) node.SetHost(host) err = node.Start(context.Background()) require.NoError(t, err) @@ -66,7 +67,7 @@ func TestFilterSubscription(t *testing.T) { b2 := relay.NewBroadcaster(10) require.NoError(t, b2.Start(context.Background())) - f := legacy_filter.NewWakuFilter(b2, false, timesource.NewDefaultClock(), utils.Logger()) + f := legacy_filter.NewWakuFilter(b2, false, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) f.SetHost(host) err = f.Start(context.Background(), relay.NoopSubscription()) require.NoError(t, err) diff --git a/examples/basic2/go.mod b/examples/basic2/go.mod index e478fc67..8057a5b4 100644 --- a/examples/basic2/go.mod +++ b/examples/basic2/go.mod @@ -112,7 +112,6 @@ require ( github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230807124929-ea702b1b4305 // indirect github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230807124913-ea636e5b4005 // indirect github.com/wk8/go-ordered-map v1.0.0 // indirect - go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.19.2 // indirect diff --git a/examples/basic2/go.sum b/examples/basic2/go.sum index bffd7944..867684a4 100644 --- a/examples/basic2/go.sum +++ b/examples/basic2/go.sum @@ -105,7 +105,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= @@ -153,9 +152,7 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= @@ -216,8 +213,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -232,7 +227,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -252,9 +246,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -271,7 +263,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -620,8 +611,6 @@ github.com/status-im/status-go/extkeys v1.1.2 h1:FSjARgDathJ3rIapJt851LsIXP9Oyuu github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -629,10 +618,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -678,8 +664,6 @@ go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -777,7 +761,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -966,7 +949,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -974,19 +956,13 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/examples/chat2/go.mod b/examples/chat2/go.mod index b720a4d5..eac1902e 100644 --- a/examples/chat2/go.mod +++ b/examples/chat2/go.mod @@ -131,7 +131,6 @@ require ( github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230807124913-ea636e5b4005 // indirect github.com/wk8/go-ordered-map v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.19.2 // indirect diff --git a/examples/chat2/go.sum b/examples/chat2/go.sum index e61abd35..d1fc696b 100644 --- a/examples/chat2/go.sum +++ b/examples/chat2/go.sum @@ -117,7 +117,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= @@ -168,9 +167,7 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= @@ -231,8 +228,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -247,7 +242,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -267,9 +261,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -286,7 +278,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -655,8 +646,6 @@ github.com/status-im/status-go/extkeys v1.1.2 h1:FSjARgDathJ3rIapJt851LsIXP9Oyuu github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -664,10 +653,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -714,8 +700,6 @@ go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -813,7 +797,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -1007,7 +990,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1015,19 +997,13 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/examples/filter2/go.mod b/examples/filter2/go.mod index 5cc2f157..184430cc 100644 --- a/examples/filter2/go.mod +++ b/examples/filter2/go.mod @@ -111,7 +111,6 @@ require ( github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230807124929-ea702b1b4305 // indirect github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230807124913-ea636e5b4005 // indirect github.com/wk8/go-ordered-map v1.0.0 // indirect - go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.19.2 // indirect diff --git a/examples/filter2/go.sum b/examples/filter2/go.sum index bffd7944..867684a4 100644 --- a/examples/filter2/go.sum +++ b/examples/filter2/go.sum @@ -105,7 +105,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= @@ -153,9 +152,7 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= @@ -216,8 +213,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -232,7 +227,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -252,9 +246,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -271,7 +263,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -620,8 +611,6 @@ github.com/status-im/status-go/extkeys v1.1.2 h1:FSjARgDathJ3rIapJt851LsIXP9Oyuu github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -629,10 +618,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -678,8 +664,6 @@ go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -777,7 +761,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -966,7 +949,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -974,19 +956,13 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/examples/noise/go.mod b/examples/noise/go.mod index 16eb5d44..d7f96904 100644 --- a/examples/noise/go.mod +++ b/examples/noise/go.mod @@ -114,7 +114,6 @@ require ( github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230807124929-ea702b1b4305 // indirect github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230807124913-ea636e5b4005 // indirect github.com/wk8/go-ordered-map v1.0.0 // indirect - go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.19.2 // indirect diff --git a/examples/noise/go.sum b/examples/noise/go.sum index b01a8878..07a1a885 100644 --- a/examples/noise/go.sum +++ b/examples/noise/go.sum @@ -105,7 +105,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= @@ -153,9 +152,7 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= @@ -216,8 +213,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -232,7 +227,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -252,9 +246,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -271,7 +263,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -620,8 +611,6 @@ github.com/status-im/status-go/extkeys v1.1.2 h1:FSjARgDathJ3rIapJt851LsIXP9Oyuu github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -629,10 +618,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -680,8 +666,6 @@ go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -779,7 +763,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -969,7 +952,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -977,19 +959,13 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/examples/rln/go.mod b/examples/rln/go.mod index cb90e9bb..494bab3a 100644 --- a/examples/rln/go.mod +++ b/examples/rln/go.mod @@ -112,7 +112,6 @@ require ( github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230807124929-ea702b1b4305 // indirect github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230807124913-ea636e5b4005 // indirect github.com/wk8/go-ordered-map v1.0.0 // indirect - go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.19.2 // indirect diff --git a/examples/rln/go.sum b/examples/rln/go.sum index bffd7944..867684a4 100644 --- a/examples/rln/go.sum +++ b/examples/rln/go.sum @@ -105,7 +105,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= @@ -153,9 +152,7 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.5/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.10.16/go.mod h1:Anj6cxczl+AHy63o4X9O8yWNHuN5wMpfb8MAnHkWn7Y= @@ -216,8 +213,6 @@ github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgR github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -232,7 +227,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -252,9 +246,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -271,7 +263,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -620,8 +611,6 @@ github.com/status-im/status-go/extkeys v1.1.2 h1:FSjARgDathJ3rIapJt851LsIXP9Oyuu github.com/status-im/status-go/extkeys v1.1.2/go.mod h1:hCmFzb2jiiVF2voZKYbzuhOQiHHCmyLJsZJXrFFg7BY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -629,10 +618,7 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -678,8 +664,6 @@ go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -777,7 +761,6 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -966,7 +949,6 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -974,19 +956,13 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/flake.nix b/flake.nix index e5e28a2e..1df25ae3 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,7 @@ ]; doCheck = false; # FIXME: This needs to be manually changed when updating modules. - vendorSha256 = "sha256-yh9ZgQpz1oDkmT65gbad+rb4pOBo8YD/pRv53pDWr2c="; + vendorSha256 = "sha256-lAozTWhzfPIQzktzzx+PkD/YcsIw4N46cgDWyrVKnkM="; # Fix for 'nix run' trying to execute 'go-waku'. meta = { mainProgram = "waku"; }; }; diff --git a/go.mod b/go.mod index 233a1a1d..49cc5ae9 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.19 replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.4 require ( - contrib.go.opencensus.io/exporter/prometheus v0.4.2 github.com/btcsuite/btcd/btcec/v2 v2.2.1 github.com/cruxic/go-hmac-drbg v0.0.0-20170206035330-84c46983886d github.com/ethereum/go-ethereum v1.10.26 @@ -95,8 +94,6 @@ require ( github.com/elastic/gosigar v0.14.2 // indirect github.com/flynn/noise v1.0.0 // indirect github.com/francoispqt/gojay v1.2.13 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect @@ -149,11 +146,10 @@ require ( github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect @@ -172,7 +168,6 @@ require ( golang.org/x/tools v0.9.1 // indirect google.golang.org/protobuf v1.31.0 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect ) diff --git a/go.sum b/go.sum index 95a96815..6fac6e16 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= -contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -148,7 +146,6 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= @@ -560,15 +557,10 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= @@ -722,7 +714,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= @@ -1317,9 +1308,6 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -1338,9 +1326,6 @@ github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1356,11 +1341,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT1pX2CziuyQR0= -github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= @@ -1505,7 +1487,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1822,7 +1803,6 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= @@ -1847,7 +1827,6 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1861,7 +1840,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1994,11 +1972,9 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2306,8 +2282,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= @@ -2346,7 +2320,6 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/library/node.go b/library/node.go index 3d544e9e..27ab9b05 100644 --- a/library/node.go +++ b/library/node.go @@ -20,6 +20,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/waku/persistence" dbutils "github.com/waku-org/go-waku/waku/persistence/utils" "github.com/waku-org/go-waku/waku/v2/node" @@ -132,7 +133,7 @@ func NewNode(configJSON string) error { return err } opts = append(opts, node.WithWakuStore()) - dbStore, err := persistence.NewDBStore(utils.Logger(), + dbStore, err := persistence.NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(migrationFn), persistence.WithRetentionPolicy(*config.RetentionMaxMessages, time.Duration(*config.RetentionTimeSeconds)*time.Second), @@ -163,6 +164,7 @@ func NewNode(configJSON string) error { } opts = append(opts, node.WithLogLevel(lvl)) + opts = append(opts, node.WithPrometheusRegisterer(prometheus.DefaultRegisterer)) w, err := node.New(opts...) if err != nil { diff --git a/waku/metrics/http.go b/waku/metrics/http.go index 463d09d6..6b734efc 100644 --- a/waku/metrics/http.go +++ b/waku/metrics/http.go @@ -5,11 +5,8 @@ import ( "fmt" "net/http" - "contrib.go.opencensus.io/exporter/prometheus" - "github.com/waku-org/go-waku/waku/v2/metrics" + "github.com/prometheus/client_golang/prometheus/promhttp" "go.opencensus.io/plugin/ochttp" - "go.opencensus.io/plugin/runmetrics" - "go.opencensus.io/stats/view" "go.uber.org/zap" ) @@ -25,21 +22,9 @@ func NewMetricsServer(address string, port int, log *zap.Logger) *Server { log: log.Named("metrics"), } - _ = runmetrics.Enable(runmetrics.RunMetricOptions{ - EnableCPU: true, - EnableMemory: true, - }) - - pe, err := prometheus.NewExporter(prometheus.Options{}) - if err != nil { - p.log.Fatal("creating Prometheus stats exporter", zap.Error(err)) - } - - view.RegisterExporter(pe) - p.log.Info("starting server", zap.String("address", address), zap.Int("port", port)) mux := http.NewServeMux() - mux.Handle("/metrics", pe) + mux.Handle("/metrics", promhttp.Handler()) // Healthcheck mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { @@ -48,40 +33,6 @@ func NewMetricsServer(address string, port int, log *zap.Logger) *Server { h := &ochttp.Handler{Handler: mux} - // Register the views - if err := view.Register( - metrics.MessageView, - metrics.MessageSizeView, - metrics.LegacyFilterErrorTypesView, - metrics.LegacyFilterMessagesView, - metrics.LegacyFilterSubscribersView, - metrics.LegacyFilterSubscriptionsView, - metrics.FilterSubscriptionsView, - metrics.FilterErrorTypesView, - metrics.FilterHandleMessageDurationView, - metrics.FilterMessagesView, - metrics.FilterRequestDurationView, - metrics.FilterRequestsView, - metrics.LightpushMessagesView, - metrics.LightpushErrorTypesView, - metrics.DnsDiscoveryNodesView, - metrics.DnsDiscoveryErrorTypesView, - metrics.DiscV5ErrorTypesView, - metrics.StoreErrorTypesView, - metrics.StoreQueriesView, - metrics.ArchiveErrorTypesView, - metrics.ArchiveInsertDurationView, - metrics.ArchiveMessagesView, - metrics.ArchiveQueryDurationView, - metrics.StoreErrorTypesView, - metrics.StoreQueriesView, - metrics.PeersView, - metrics.DialsView, - metrics.VersionView, - ); err != nil { - p.log.Fatal("registering views", zap.Error(err)) - } - p.server = &http.Server{ Addr: fmt.Sprintf("%s:%d", address, port), Handler: h, diff --git a/waku/persistence/metrics.go b/waku/persistence/metrics.go new file mode 100644 index 00000000..92ff83b2 --- /dev/null +++ b/waku/persistence/metrics.go @@ -0,0 +1,87 @@ +package persistence + +import ( + "time" + + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var archiveMessages = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_archive_messages", + Help: "The number of messages stored via archive protocol", + }) + +var archiveErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_archive_errors", + Help: "The distribution of the archive protocol errors", + }, + []string{"error_type"}, +) + +var archiveInsertDurationSeconds = prometheus.NewHistogram( + prometheus.HistogramOpts{ + Name: "waku_archive_insert_duration_seconds", + Help: "Message insertion duration", + }) + +var archiveQueryDurationSeconds = prometheus.NewHistogram( + prometheus.HistogramOpts{ + Name: "waku_archive_query_duration_seconds", + Help: "History query duration", + }) + +var collectors = []prometheus.Collector{ + archiveMessages, + archiveErrors, + archiveInsertDurationSeconds, + archiveQueryDurationSeconds, +} + +// Metrics exposes the functions required to update prometheus metrics for archive protocol +type Metrics interface { + RecordMessage(num int) + RecordError(err metricsErrCategory) + RecordInsertDuration(duration time.Duration) + RecordQueryDuration(duration time.Duration) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +// RecordMessage increases the counter for the number of messages stored in the archive +func (m *metricsImpl) RecordMessage(num int) { + archiveMessages.Add(float64(num)) +} + +type metricsErrCategory string + +var ( + retPolicyFailure metricsErrCategory = "retpolicy_failure" + insertFailure metricsErrCategory = "retpolicy_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + archiveErrors.WithLabelValues(string(err)).Inc() +} + +// RecordInsertDuration tracks the duration for inserting a record in the archive database +func (m *metricsImpl) RecordInsertDuration(duration time.Duration) { + archiveInsertDurationSeconds.Observe(duration.Seconds()) +} + +// RecordQueryDuration tracks the duration for executing a query in the archive database +func (m *metricsImpl) RecordQueryDuration(duration time.Duration) { + archiveQueryDurationSeconds.Observe(duration.Seconds()) +} diff --git a/waku/persistence/store.go b/waku/persistence/store.go index e1a7c22b..81c40275 100644 --- a/waku/persistence/store.go +++ b/waku/persistence/store.go @@ -9,13 +9,12 @@ import ( "sync" "time" - "github.com/waku-org/go-waku/waku/v2/metrics" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/waku/v2/protocol" wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/protocol/store/pb" "github.com/waku-org/go-waku/waku/v2/timesource" "github.com/waku-org/go-waku/waku/v2/utils" - "go.opencensus.io/stats" "go.uber.org/zap" ) @@ -52,6 +51,7 @@ type DBStore struct { db *sql.DB migrationFn func(db *sql.DB) error + metrics Metrics timesource timesource.Timesource log *zap.Logger @@ -141,9 +141,10 @@ func DefaultOptions() []DBOption { // Creates a new DB store using the db specified via options. // It will create a messages table if it does not exist and // clean up records according to the retention policy used -func NewDBStore(log *zap.Logger, options ...DBOption) (*DBStore, error) { +func NewDBStore(reg prometheus.Registerer, log *zap.Logger, options ...DBOption) (*DBStore, error) { result := new(DBStore) result.log = log.Named("dbstore") + result.metrics = newMetrics(reg) optList := DefaultOptions() optList = append(optList, options...) @@ -196,7 +197,7 @@ func (d *DBStore) updateMetrics(ctx context.Context) { if err != nil { d.log.Error("updating store metrics", zap.Error(err)) } else { - metrics.RecordArchiveMessage(ctx, "stored", msgCount) + d.metrics.RecordMessage(msgCount) } case <-ctx.Done(): return @@ -213,7 +214,7 @@ func (d *DBStore) cleanOlderRecords(ctx context.Context) error { sqlStmt := `DELETE FROM message WHERE receiverTimestamp < $1` _, err := d.db.Exec(sqlStmt, utils.GetUnixEpochFrom(d.timesource.Now().Add(-d.maxDuration))) if err != nil { - metrics.RecordArchiveError(ctx, "retpolicy_failure") + d.metrics.RecordError(retPolicyFailure) return err } elapsed := time.Since(start) @@ -226,7 +227,7 @@ func (d *DBStore) cleanOlderRecords(ctx context.Context) error { sqlStmt := `DELETE FROM message WHERE id IN (SELECT id FROM message ORDER BY receiverTimestamp DESC LIMIT -1 OFFSET $1)` _, err := d.db.Exec(sqlStmt, d.maxMessages) if err != nil { - metrics.RecordArchiveError(ctx, "retpolicy_failure") + d.metrics.RecordError(retPolicyFailure) return err } elapsed := time.Since(start) @@ -290,7 +291,7 @@ func (d *DBStore) Validate(env *protocol.Envelope) error { func (d *DBStore) Put(env *protocol.Envelope) error { stmt, err := d.db.Prepare("INSERT INTO message (id, receiverTimestamp, senderTimestamp, contentTopic, pubsubTopic, payload, version) VALUES ($1, $2, $3, $4, $5, $6, $7)") if err != nil { - metrics.RecordArchiveError(context.TODO(), "insert_failure") + d.metrics.RecordError(insertFailure) return err } @@ -302,8 +303,8 @@ func (d *DBStore) Put(env *protocol.Envelope) error { if err != nil { return err } - ellapsed := time.Since(start) - stats.Record(context.Background(), metrics.ArchiveInsertDurationSeconds.M(int64(ellapsed.Seconds()))) + + d.metrics.RecordInsertDuration(time.Since(start)) err = stmt.Close() if err != nil { @@ -442,8 +443,8 @@ func (d *DBStore) Query(query *pb.HistoryQuery) (*pb.Index, []StoredMessage, err if err != nil { return nil, nil, err } - ellapsed := time.Since(measurementStart) - stats.Record(context.Background(), metrics.ArchiveQueryDurationSeconds.M(int64(ellapsed.Seconds()))) + + d.metrics.RecordQueryDuration(time.Since(measurementStart)) var result []StoredMessage for rows.Next() { diff --git a/waku/persistence/store_test.go b/waku/persistence/store_test.go index 0300fb30..5d430ac7 100644 --- a/waku/persistence/store_test.go +++ b/waku/persistence/store_test.go @@ -8,6 +8,7 @@ import ( "github.com/golang-migrate/migrate/v4/database/sqlite3" _ "github.com/mattn/go-sqlite3" // Blank import to register the sqlite3 driver + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/persistence/migrate" @@ -39,7 +40,7 @@ func NewMock() *sql.DB { func TestDbStore(t *testing.T) { db := NewMock() - store, err := NewDBStore(utils.Logger(), WithDB(db), WithMigrations(Migrate)) + store, err := NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), WithDB(db), WithMigrations(Migrate)) require.NoError(t, err) err = store.Start(context.Background(), timesource.NewDefaultClock()) @@ -59,7 +60,7 @@ func TestDbStore(t *testing.T) { func TestStoreRetention(t *testing.T) { db := NewMock() - store, err := NewDBStore(utils.Logger(), WithDB(db), WithMigrations(Migrate), WithRetentionPolicy(5, 20*time.Second)) + store, err := NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), WithDB(db), WithMigrations(Migrate), WithRetentionPolicy(5, 20*time.Second)) require.NoError(t, err) err = store.Start(context.Background(), timesource.NewDefaultClock()) @@ -82,7 +83,7 @@ func TestStoreRetention(t *testing.T) { // This step simulates starting go-waku again from scratch - store, err = NewDBStore(utils.Logger(), WithDB(db), WithRetentionPolicy(5, 40*time.Second)) + store, err = NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), WithDB(db), WithRetentionPolicy(5, 40*time.Second)) require.NoError(t, err) err = store.Start(context.Background(), timesource.NewDefaultClock()) diff --git a/waku/v2/discv5/discover.go b/waku/v2/discv5/discover.go index 6cd056c1..6ea17f72 100644 --- a/waku/v2/discv5/discover.go +++ b/waku/v2/discv5/discover.go @@ -13,9 +13,9 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-discover/discover" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/peerstore" wenr "github.com/waku-org/go-waku/waku/v2/protocol/enr" @@ -40,6 +40,7 @@ type DiscoveryV5 struct { udpAddr *net.UDPAddr listener *discover.UDPv5 localnode *enode.LocalNode + metrics Metrics peerConnector PeerConnector peerCh chan peermanager.PeerData @@ -112,7 +113,8 @@ func DefaultOptions() []DiscoveryV5Option { } } -func NewDiscoveryV5(priv *ecdsa.PrivateKey, localnode *enode.LocalNode, peerConnector PeerConnector, log *zap.Logger, opts ...DiscoveryV5Option) (*DiscoveryV5, error) { +// NewDiscoveryV5 returns a new instance of a DiscoveryV5 struct +func NewDiscoveryV5(priv *ecdsa.PrivateKey, localnode *enode.LocalNode, peerConnector PeerConnector, reg prometheus.Registerer, log *zap.Logger, opts ...DiscoveryV5Option) (*DiscoveryV5, error) { params := new(discV5Parameters) optList := DefaultOptions() optList = append(optList, opts...) @@ -133,6 +135,7 @@ func NewDiscoveryV5(priv *ecdsa.PrivateKey, localnode *enode.LocalNode, peerConn NAT: NAT, wg: &sync.WaitGroup{}, localnode: localnode, + metrics: newMetrics(reg), config: discover.Config{ PrivateKey: priv, Bootnodes: params.bootnodes, @@ -267,25 +270,27 @@ func isWakuNode(node *enode.Node) bool { } */ -func evaluateNode(node *enode.Node) bool { - if node == nil { - return false +func (d *DiscoveryV5) evaluateNode() func(node *enode.Node) bool { + return func(node *enode.Node) bool { + if node == nil { + return false + } + + // TODO: consider node filtering based on ENR; we do not filter based on ENR in the first waku discv5 beta stage + /*if !isWakuNode(node) { + return false + }*/ + + _, err := wenr.EnodeToPeerInfo(node) + + if err != nil { + d.metrics.RecordError(peerInfoFailure) + utils.Logger().Named("discv5").Error("obtaining peer info from enode", logging.ENode("enr", node), zap.Error(err)) + return false + } + + return true } - - // TODO: consider node filtering based on ENR; we do not filter based on ENR in the first waku discv5 beta stage - /*if !isWakuNode(node) { - return false - }*/ - - _, err := wenr.EnodeToPeerInfo(node) - - if err != nil { - metrics.RecordDiscV5Error(context.Background(), "peer_info_failure") - utils.Logger().Named("discv5").Error("obtaining peer info from enode", logging.ENode("enr", node), zap.Error(err)) - return false - } - - return true } // Predicate is a function that is applied to an iterator to filter the nodes to be retrieved according to some logic @@ -299,7 +304,7 @@ func (d *DiscoveryV5) PeerIterator(predicate ...Predicate) (enode.Iterator, erro return nil, ErrNoDiscV5Listener } - iterator := enode.Filter(d.listener.RandomNodes(), evaluateNode) + iterator := enode.Filter(d.listener.RandomNodes(), d.evaluateNode()) if d.params.loopPredicate != nil { iterator = enode.Filter(iterator, d.params.loopPredicate) } @@ -335,14 +340,14 @@ func (d *DiscoveryV5) Iterate(ctx context.Context, iterator enode.Iterator, onNo _, addresses, err := wenr.Multiaddress(iterator.Node()) if err != nil { - metrics.RecordDiscV5Error(context.Background(), "peer_info_failure") + d.metrics.RecordError(peerInfoFailure) d.log.Error("extracting multiaddrs from enr", zap.Error(err)) continue } peerAddrs, err := peer.AddrInfosFromP2pAddrs(addresses...) if err != nil { - metrics.RecordDiscV5Error(context.Background(), "peer_info_failure") + d.metrics.RecordError(peerInfoFailure) d.log.Error("converting multiaddrs to addrinfos", zap.Error(err)) continue } @@ -415,7 +420,7 @@ func (d *DiscoveryV5) peerLoop(ctx context.Context) error { return false })) if err != nil { - metrics.RecordDiscV5Error(context.Background(), "iterator_failure") + d.metrics.RecordError(iteratorFailure) return fmt.Errorf("obtaining iterator: %w", err) } diff --git a/waku/v2/discv5/discover_test.go b/waku/v2/discv5/discover_test.go index 1a3b3925..e24bc990 100644 --- a/waku/v2/discv5/discover_test.go +++ b/waku/v2/discv5/discover_test.go @@ -13,6 +13,7 @@ import ( gcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" + "github.com/prometheus/client_golang/prometheus" wenr "github.com/waku-org/go-waku/waku/v2/protocol/enr" "github.com/multiformats/go-multiaddr" @@ -108,7 +109,7 @@ func TestDiscV5(t *testing.T) { l1, err := newLocalnode(prvKey1, ip1, udpPort1, wenr.NewWakuEnrBitfield(true, true, true, true), nil, utils.Logger()) require.NoError(t, err) peerconn1 := tests.NewTestPeerDiscoverer() - d1, err := NewDiscoveryV5(prvKey1, l1, peerconn1, utils.Logger(), WithUDPPort(uint(udpPort1))) + d1, err := NewDiscoveryV5(prvKey1, l1, peerconn1, prometheus.DefaultRegisterer, utils.Logger(), WithUDPPort(uint(udpPort1))) require.NoError(t, err) d1.SetHost(host1) @@ -120,7 +121,7 @@ func TestDiscV5(t *testing.T) { l2, err := newLocalnode(prvKey2, ip2, udpPort2, wenr.NewWakuEnrBitfield(true, true, true, true), nil, utils.Logger()) require.NoError(t, err) peerconn2 := tests.NewTestPeerDiscoverer() - d2, err := NewDiscoveryV5(prvKey2, l2, peerconn2, utils.Logger(), WithUDPPort(uint(udpPort2)), WithBootnodes([]*enode.Node{d1.localnode.Node()})) + d2, err := NewDiscoveryV5(prvKey2, l2, peerconn2, prometheus.DefaultRegisterer, utils.Logger(), WithUDPPort(uint(udpPort2)), WithBootnodes([]*enode.Node{d1.localnode.Node()})) require.NoError(t, err) d2.SetHost(host2) @@ -132,7 +133,7 @@ func TestDiscV5(t *testing.T) { l3, err := newLocalnode(prvKey3, ip3, udpPort3, wenr.NewWakuEnrBitfield(true, true, true, true), nil, utils.Logger()) require.NoError(t, err) peerconn3 := tests.NewTestPeerDiscoverer() - d3, err := NewDiscoveryV5(prvKey3, l3, peerconn3, utils.Logger(), WithUDPPort(uint(udpPort3)), WithBootnodes([]*enode.Node{d2.localnode.Node()})) + d3, err := NewDiscoveryV5(prvKey3, l3, peerconn3, prometheus.DefaultRegisterer, utils.Logger(), WithUDPPort(uint(udpPort3)), WithBootnodes([]*enode.Node{d2.localnode.Node()})) require.NoError(t, err) d3.SetHost(host3) diff --git a/waku/v2/discv5/metrics.go b/waku/v2/discv5/metrics.go new file mode 100644 index 00000000..944a3db4 --- /dev/null +++ b/waku/v2/discv5/metrics.go @@ -0,0 +1,46 @@ +package discv5 + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var discV5Errors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_discv5_errors", + Help: "The distribution of the discv5 protocol errors", + }, + []string{"error_type"}, +) + +var collectors = []prometheus.Collector{ + discV5Errors, +} + +// Metrics exposes the functions required to update prometheus metrics for discv5 protocol +type Metrics interface { + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +type metricsErrCategory string + +var ( + peerInfoFailure metricsErrCategory = "peer_info_failure" + iteratorFailure metricsErrCategory = "iterator_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + discV5Errors.WithLabelValues(string(err)).Inc() +} diff --git a/waku/v2/dnsdisc/enr.go b/waku/v2/dnsdisc/enr.go index 7129a463..d53c7da1 100644 --- a/waku/v2/dnsdisc/enr.go +++ b/waku/v2/dnsdisc/enr.go @@ -7,8 +7,10 @@ import ( "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" "github.com/libp2p/go-libp2p/core/peer" - "github.com/waku-org/go-waku/waku/v2/metrics" + "github.com/prometheus/client_golang/prometheus" wenr "github.com/waku-org/go-waku/waku/v2/protocol/enr" + "github.com/waku-org/go-waku/waku/v2/utils" + "go.uber.org/zap" ) type dnsDiscoveryParameters struct { @@ -30,6 +32,17 @@ type DiscoveredNode struct { ENR *enode.Node } +var metrics Metrics = nil + +// SetPrometheusRegisterer is used to setup a custom prometheus registerer for metrics +func SetPrometheusRegisterer(reg prometheus.Registerer, logger *zap.Logger) { + metrics = newMetrics(reg) +} + +func init() { + SetPrometheusRegisterer(prometheus.DefaultRegisterer, utils.Logger()) +} + // RetrieveNodes returns a list of multiaddress given a url to a DNS discoverable ENR tree func RetrieveNodes(ctx context.Context, url string, opts ...DnsDiscoveryOption) ([]DiscoveredNode, error) { var discoveredNodes []DiscoveredNode @@ -45,14 +58,14 @@ func RetrieveNodes(ctx context.Context, url string, opts ...DnsDiscoveryOption) tree, err := client.SyncTree(url) if err != nil { - metrics.RecordDnsDiscoveryError(ctx, "tree_sync_failure") + metrics.RecordError(treeSyncFailure) return nil, err } for _, node := range tree.Nodes() { peerID, m, err := wenr.Multiaddress(node) if err != nil { - metrics.RecordDnsDiscoveryError(ctx, "peer_info_failure") + metrics.RecordError(peerInfoFailure) return nil, err } @@ -81,6 +94,8 @@ func RetrieveNodes(ctx context.Context, url string, opts ...DnsDiscoveryOption) discoveredNodes = append(discoveredNodes, d) } + metrics.RecordDiscoveredNodes(len(discoveredNodes)) + return discoveredNodes, nil } diff --git a/waku/v2/dnsdisc/metrics.go b/waku/v2/dnsdisc/metrics.go new file mode 100644 index 00000000..7ebd1153 --- /dev/null +++ b/waku/v2/dnsdisc/metrics.go @@ -0,0 +1,59 @@ +package dnsdisc + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var dnsDiscoveredNodes = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_dnsdisc_discovered", + Help: "The number of nodes discovered via DNS discovery", + }, +) + +var dnsDiscoveryErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_dnsdisc_errors", + Help: "The distribution of the dns discovery protocol errors", + }, + []string{"error_type"}, +) + +var collectors = []prometheus.Collector{ + dnsDiscoveredNodes, + dnsDiscoveryErrors, +} + +// Metrics exposes the functions required to update prometheus metrics for dnsdisc protocol +type Metrics interface { + RecordDiscoveredNodes(numNodes int) + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +type metricsErrCategory string + +var ( + treeSyncFailure metricsErrCategory = "tree_sync_failure" + peerInfoFailure metricsErrCategory = "peer_info_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + dnsDiscoveryErrors.WithLabelValues(string(err)).Inc() +} + +func (m *metricsImpl) RecordDiscoveredNodes(numNodes int) { + dnsDiscoveredNodes.Add(float64(numNodes)) +} diff --git a/waku/v2/metrics/metrics.go b/waku/v2/metrics/metrics.go deleted file mode 100644 index 73134663..00000000 --- a/waku/v2/metrics/metrics.go +++ /dev/null @@ -1,313 +0,0 @@ -package metrics - -import ( - "context" - "fmt" - "time" - - "github.com/waku-org/go-waku/waku/v2/utils" - "go.opencensus.io/stats" - "go.opencensus.io/stats/view" - "go.opencensus.io/tag" - "go.uber.org/zap" -) - -var ( - WakuVersion = stats.Int64("waku_version", "", stats.UnitDimensionless) - Messages = stats.Int64("node_messages", "Number of messages received", stats.UnitDimensionless) - MessageSize = stats.Int64("waku_histogram_message_size", "message size histogram in kB", stats.UnitDimensionless) - - Peers = stats.Int64("peers", "Number of connected peers", stats.UnitDimensionless) - Dials = stats.Int64("dials", "Number of peer dials", stats.UnitDimensionless) - - LegacyFilterMessages = stats.Int64("legacy_filter_messages", "Number of legacy filter messages", stats.UnitDimensionless) - LegacyFilterSubscribers = stats.Int64("legacy_filter_subscribers", "Number of legacy filter subscribers", stats.UnitDimensionless) - LegacyFilterSubscriptions = stats.Int64("legacy_filter_subscriptions", "Number of legacy filter subscriptions", stats.UnitDimensionless) - LegacyFilterErrors = stats.Int64("legacy_filter_errors", "Number of errors in legacy filter protocol", stats.UnitDimensionless) - - FilterMessages = stats.Int64("filter_messages", "Number of filter messages", stats.UnitDimensionless) - FilterRequests = stats.Int64("filter_requests", "Number of filter requests", stats.UnitDimensionless) - FilterSubscriptions = stats.Int64("filter_subscriptions", "Number of filter subscriptions", stats.UnitDimensionless) - FilterErrors = stats.Int64("filter_errors", "Number of errors in filter protocol", stats.UnitDimensionless) - FilterRequestDurationSeconds = stats.Int64("filter_request_duration_seconds", "Duration of Filter Subscribe Requests", stats.UnitSeconds) - FilterHandleMessageDurationSeconds = stats.Int64("filter_handle_msessageduration_seconds", "Duration to Push Message to Filter Subscribers", stats.UnitSeconds) - - StoreErrors = stats.Int64("errors", "Number of errors in store protocol", stats.UnitDimensionless) - StoreQueries = stats.Int64("store_queries", "Number of store queries", stats.UnitDimensionless) - - ArchiveMessages = stats.Int64("waku_archive_messages", "Number of historical messages", stats.UnitDimensionless) - ArchiveErrors = stats.Int64("waku_archive_errors", "Number of errors in archive protocol", stats.UnitDimensionless) - ArchiveInsertDurationSeconds = stats.Int64("waku_archive_insert_duration_seconds", "Message insertion duration", stats.UnitSeconds) - ArchiveQueryDurationSeconds = stats.Int64("waku_archive_query_duration_seconds", "History query duration", stats.UnitSeconds) - - LightpushMessages = stats.Int64("lightpush_messages", "Number of messages sent via lightpush protocol", stats.UnitDimensionless) - LightpushErrors = stats.Int64("errors", "Number of errors in lightpush protocol", stats.UnitDimensionless) - - PeerExchangeError = stats.Int64("errors", "Number of errors in peer exchange protocol", stats.UnitDimensionless) - - DnsDiscoveryNodes = stats.Int64("dnsdisc_nodes", "Number of discovered nodes in dns discovert", stats.UnitDimensionless) - DnsDiscoveryErrors = stats.Int64("dnsdisc_errors", "Number of errors in dns discovery", stats.UnitDimensionless) - - DiscV5Errors = stats.Int64("discv5_errors", "Number of errors in discv5", stats.UnitDimensionless) -) - -var ( - KeyType, _ = tag.NewKey("type") - ErrorType, _ = tag.NewKey("error_type") - GitVersion, _ = tag.NewKey("git_version") -) - -var ( - PeersView = &view.View{ - Name: "waku_connected_peers", - Measure: Peers, - Description: "Number of connected peers", - Aggregation: view.Sum(), - } - DialsView = &view.View{ - Name: "waku_peers_dials", - Measure: Dials, - Description: "Number of peer dials", - Aggregation: view.Count(), - } - MessageView = &view.View{ - Name: "waku_node_messages", - Measure: Messages, - Description: "The number of the messages received", - Aggregation: view.Count(), - } - MessageSizeView = &view.View{ - Name: "waku_histogram_message_size", - Measure: MessageSize, - Description: "message size histogram in kB", - Aggregation: view.Distribution(0.0, 5.0, 15.0, 50.0, 100.0, 300.0, 700.0, 1000.0), - } - - StoreQueriesView = &view.View{ - Name: "waku_store_queries", - Measure: StoreQueries, - Description: "The number of the store queries received", - Aggregation: view.Count(), - } - StoreErrorTypesView = &view.View{ - Name: "waku_store_errors", - Measure: StoreErrors, - Description: "The distribution of the store protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - - ArchiveMessagesView = &view.View{ - Name: "waku_archive_messages", - Measure: ArchiveMessages, - Description: "The distribution of the archive protocol messages", - Aggregation: view.LastValue(), - TagKeys: []tag.Key{KeyType}, - } - ArchiveErrorTypesView = &view.View{ - Name: "waku_archive_errors", - Measure: StoreErrors, - Description: "Number of errors in archive protocol", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - ArchiveInsertDurationView = &view.View{ - Name: "waku_archive_insert_duration_seconds", - Measure: ArchiveInsertDurationSeconds, - Description: "Message insertion duration", - Aggregation: view.Count(), - } - ArchiveQueryDurationView = &view.View{ - Name: "waku_archive_query_duration_seconds", - Measure: ArchiveQueryDurationSeconds, - Description: "History query duration", - Aggregation: view.Count(), - } - - LegacyFilterSubscriptionsView = &view.View{ - Name: "waku_legacy_filter_subscriptions", - Measure: LegacyFilterSubscriptions, - Description: "The number of legacy filter subscriptions", - Aggregation: view.Count(), - } - LegacyFilterSubscribersView = &view.View{ - Name: "waku_legacy_filter_subscribers", - Measure: LegacyFilterSubscribers, - Description: "The number of legacy filter subscribers", - Aggregation: view.LastValue(), - } - LegacyFilterMessagesView = &view.View{ - Name: "waku_legacy_filter_messages", - Measure: LegacyFilterMessages, - Description: "The distribution of the legacy filter protocol messages received", - Aggregation: view.Count(), - TagKeys: []tag.Key{KeyType}, - } - LegacyFilterErrorTypesView = &view.View{ - Name: "waku_legacy_filter_errors", - Measure: LegacyFilterErrors, - Description: "The distribution of the legacy filter protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - - FilterSubscriptionsView = &view.View{ - Name: "waku_filter_subscriptions", - Measure: FilterSubscriptions, - Description: "The number of filter subscriptions", - Aggregation: view.Count(), - } - FilterRequestsView = &view.View{ - Name: "waku_filter_requests", - Measure: FilterRequests, - Description: "The number of filter requests", - Aggregation: view.Count(), - } - FilterMessagesView = &view.View{ - Name: "waku_filter_messages", - Measure: FilterMessages, - Description: "The distribution of the filter protocol messages received", - Aggregation: view.Count(), - TagKeys: []tag.Key{KeyType}, - } - FilterErrorTypesView = &view.View{ - Name: "waku_filter_errors", - Measure: FilterErrors, - Description: "The distribution of the filter protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - - FilterRequestDurationView = &view.View{ - Name: "waku_filter_request_duration_seconds", - Measure: FilterRequestDurationSeconds, - Description: "Duration of Filter Subscribe Requests", - Aggregation: view.Count(), - } - FilterHandleMessageDurationView = &view.View{ - Name: "waku_filter_handle_msessageduration_seconds", - Measure: FilterHandleMessageDurationSeconds, - Description: "Duration to Push Message to Filter Subscribers", - Aggregation: view.Count(), - } - - LightpushMessagesView = &view.View{ - Name: "waku_lightpush_messages", - Measure: LightpushMessages, - Description: "The distribution of the lightpush protocol messages", - Aggregation: view.LastValue(), - TagKeys: []tag.Key{KeyType}, - } - LightpushErrorTypesView = &view.View{ - Name: "waku_lightpush_errors", - Measure: LightpushErrors, - Description: "The distribution of the lightpush protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - VersionView = &view.View{ - Name: "waku_version", - Measure: WakuVersion, - Description: "The gowaku version", - Aggregation: view.LastValue(), - TagKeys: []tag.Key{GitVersion}, - } - DnsDiscoveryNodesView = &view.View{ - Name: "waku_dnsdisc_discovered", - Measure: DnsDiscoveryNodes, - Description: "The number of nodes discovered via DNS discovery", - Aggregation: view.Count(), - } - DnsDiscoveryErrorTypesView = &view.View{ - Name: "waku_dnsdisc_errors", - Measure: DnsDiscoveryErrors, - Description: "The distribution of the dns discovery protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } - DiscV5ErrorTypesView = &view.View{ - Name: "waku_discv5_errors", - Measure: DiscV5Errors, - Description: "The distribution of the discv5 protocol errors", - Aggregation: view.Count(), - TagKeys: []tag.Key{ErrorType}, - } -) - -func recordWithTags(ctx context.Context, tagKey tag.Key, tagType string, ms stats.Measurement) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(tagKey, tagType)}, ms); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } -} - -func RecordLightpushMessage(ctx context.Context, tagType string) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(KeyType, tagType)}, LightpushMessages.M(1)); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } -} - -func RecordLightpushError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, LightpushErrors.M(1)) -} - -func RecordLegacyFilterError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, LegacyFilterErrors.M(1)) -} - -func RecordArchiveError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, ArchiveErrors.M(1)) -} - -func RecordFilterError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, FilterErrors.M(1)) -} - -func RecordFilterRequest(ctx context.Context, tagType string, duration time.Duration) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(KeyType, tagType)}, FilterRequests.M(1)); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } - FilterRequestDurationSeconds.M(int64(duration.Seconds())) -} - -func RecordFilterMessage(ctx context.Context, tagType string, len int) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(KeyType, tagType)}, FilterMessages.M(int64(len))); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } -} - -func RecordLegacyFilterMessage(ctx context.Context, tagType string, len int) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(KeyType, tagType)}, LegacyFilterMessages.M(int64(len))); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } -} - -func RecordPeerExchangeError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, PeerExchangeError.M(1)) -} - -func RecordDnsDiscoveryError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, DnsDiscoveryErrors.M(1)) -} - -func RecordDiscV5Error(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, DiscV5Errors.M(1)) -} - -func RecordArchiveMessage(ctx context.Context, tagType string, len int) { - if err := stats.RecordWithTags(ctx, []tag.Mutator{tag.Insert(KeyType, tagType)}, ArchiveMessages.M(int64(len))); err != nil { - utils.Logger().Error("failed to record with tags", zap.Error(err)) - } -} - -func RecordStoreQuery(ctx context.Context) { - stats.Record(ctx, StoreQueries.M(1)) -} - -func RecordStoreError(ctx context.Context, tagType string) { - recordWithTags(ctx, ErrorType, tagType, StoreErrors.M(1)) -} - -func RecordVersion(ctx context.Context, version string, commit string) { - v := fmt.Sprintf("%s-%s", version, commit) - recordWithTags(ctx, GitVersion, v, WakuVersion.M(1)) -} diff --git a/waku/v2/node/connectedness.go b/waku/v2/node/connectedness.go index 66b0313e..e1d5321a 100644 --- a/waku/v2/node/connectedness.go +++ b/waku/v2/node/connectedness.go @@ -9,12 +9,10 @@ import ( "github.com/libp2p/go-libp2p/core/protocol" "github.com/multiformats/go-multiaddr" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/protocol/legacy_filter" "github.com/waku-org/go-waku/waku/v2/protocol/lightpush" "github.com/waku-org/go-waku/waku/v2/protocol/relay" "github.com/waku-org/go-waku/waku/v2/protocol/store" - "go.opencensus.io/stats" "go.uber.org/zap" wps "github.com/waku-org/go-waku/waku/v2/peerstore" @@ -42,18 +40,19 @@ type ConnectionNotifier struct { h host.Host ctx context.Context log *zap.Logger + metrics Metrics connNotifCh chan<- PeerConnection DisconnectChan chan peer.ID - quit chan struct{} } -func NewConnectionNotifier(ctx context.Context, h host.Host, connNotifCh chan<- PeerConnection, log *zap.Logger) ConnectionNotifier { +// NewConnectionNotifier creates an instance of ConnectionNotifier to react to peer connection changes +func NewConnectionNotifier(ctx context.Context, h host.Host, connNotifCh chan<- PeerConnection, metrics Metrics, log *zap.Logger) ConnectionNotifier { return ConnectionNotifier{ h: h, ctx: ctx, DisconnectChan: make(chan peer.ID, 100), connNotifCh: connNotifCh, - quit: make(chan struct{}), + metrics: metrics, log: log.Named("connection-notifier"), } } @@ -81,13 +80,14 @@ func (c ConnectionNotifier) Connected(n network.Network, cc network.Conn) { if err != nil { c.log.Error("Failed to set peer direction for an outgoing connection", zap.Error(err)) } - stats.Record(c.ctx, metrics.Peers.M(1)) + + c.metrics.RecordPeerConnected() } // Disconnected is called when a connection closed func (c ConnectionNotifier) Disconnected(n network.Network, cc network.Conn) { c.log.Info("peer disconnected", logging.HostID("peer", cc.RemotePeer())) - stats.Record(c.ctx, metrics.Peers.M(-1)) + c.metrics.RecordPeerDisconnected() c.DisconnectChan <- cc.RemotePeer() if c.connNotifCh != nil { select { @@ -108,7 +108,6 @@ func (c ConnectionNotifier) ClosedStream(n network.Network, s network.Stream) { // Close quits the ConnectionNotifier func (c ConnectionNotifier) Close() { - close(c.quit) } func (w *WakuNode) sendConnStatus() { diff --git a/waku/v2/node/connectedness_test.go b/waku/v2/node/connectedness_test.go index 098c6790..192d4a2a 100644 --- a/waku/v2/node/connectedness_test.go +++ b/waku/v2/node/connectedness_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/waku/persistence" "github.com/waku-org/go-waku/waku/persistence/sqlite" @@ -71,7 +72,7 @@ func TestConnectionStatusChanges(t *testing.T) { db, err := sqlite.NewDB(":memory:", false, utils.Logger()) require.NoError(t, err) - dbStore, err := persistence.NewDBStore(utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) + dbStore, err := persistence.NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) require.NoError(t, err) // Node3: Relay + Store diff --git a/waku/v2/node/metrics.go b/waku/v2/node/metrics.go new file mode 100644 index 00000000..cad8c27c --- /dev/null +++ b/waku/v2/node/metrics.go @@ -0,0 +1,74 @@ +package node + +import ( + "fmt" + + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var gitVersion = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: "waku_version", + Help: "The go-waku version", + }, + []string{"git_version"}, +) + +var peerDials = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_peers_dials", + Help: "Number of peer dials", + }) + +var connectedPeers = prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "waku_connected_peers", + Help: "Number of connected peers", + }) + +var collectors = []prometheus.Collector{ + gitVersion, + peerDials, + connectedPeers, +} + +// Metrics exposes the functions required to update prometheus metrics for the waku node +type Metrics interface { + RecordVersion(version string, commit string) + RecordDial() + RecordPeerConnected() + RecordPeerDisconnected() +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +// RecordVersion registers a metric with the current version and commit of go-waku +func (m *metricsImpl) RecordVersion(version string, commit string) { + v := fmt.Sprintf("%s-%s", version, commit) + gitVersion.WithLabelValues(v).Inc() +} + +// RecordDial increases the counter for the number of dials +func (m *metricsImpl) RecordDial() { + peerDials.Inc() +} + +// RecordPeerConnected increases the metrics for the number of connected peers +func (m *metricsImpl) RecordPeerConnected() { + connectedPeers.Inc() +} + +// RecordPeerDisconnected decreases the metrics for the number of connected peers +func (m *metricsImpl) RecordPeerDisconnected() { + connectedPeers.Dec() +} diff --git a/waku/v2/node/wakunode2.go b/waku/v2/node/wakunode2.go index 3dce46c6..a4567533 100644 --- a/waku/v2/node/wakunode2.go +++ b/waku/v2/node/wakunode2.go @@ -27,11 +27,9 @@ import ( "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/proto" ws "github.com/libp2p/go-libp2p/p2p/transport/websocket" ma "github.com/multiformats/go-multiaddr" - "go.opencensus.io/stats" "github.com/waku-org/go-waku/logging" "github.com/waku-org/go-waku/waku/v2/discv5" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" wps "github.com/waku-org/go-waku/waku/v2/peerstore" "github.com/waku-org/go-waku/waku/v2/protocol/enr" @@ -80,6 +78,7 @@ type WakuNode struct { opts *WakuNodeParameters log *zap.Logger timesource timesource.Timesource + metrics Metrics peerstore peerstore.Peerstore peerConnector *peermanager.PeerConnectionStrategy @@ -124,7 +123,7 @@ type WakuNode struct { } func defaultStoreFactory(w *WakuNode) store.Store { - return store.NewWakuStore(w.opts.messageProvider, w.peermanager, w.timesource, w.log) + return store.NewWakuStore(w.opts.messageProvider, w.peermanager, w.timesource, w.opts.prometheusReg, w.log) } // New is used to instantiate a WakuNode using a set of WakuNodeOptions @@ -192,6 +191,9 @@ func New(opts ...WakuNodeOption) (*WakuNode, error) { w.keepAliveFails = make(map[peer.ID]int) w.wakuFlag = enr.NewWakuEnrBitfield(w.opts.enableLightPush, w.opts.enableLegacyFilter, w.opts.enableStore, w.opts.enableRelay) w.circuitRelayNodes = make(chan peer.AddrInfo) + w.metrics = newMetrics(params.prometheusReg) + + w.metrics.RecordVersion(Version, GitCommit) // Setup peerstore wrapper if params.peerstore != nil { @@ -267,17 +269,17 @@ func New(opts ...WakuNodeOption) (*WakuNode, error) { } } - w.peerExchange, err = peer_exchange.NewWakuPeerExchange(w.DiscV5(), w.peerConnector, w.peermanager, w.log) + w.peerExchange, err = peer_exchange.NewWakuPeerExchange(w.DiscV5(), w.peerConnector, w.peermanager, w.opts.prometheusReg, w.log) if err != nil { return nil, err } w.rendezvous = rendezvous.NewRendezvous(w.opts.rendezvousDB, w.peerConnector, w.log) - w.relay = relay.NewWakuRelay(w.bcaster, w.opts.minRelayPeersToPublish, w.timesource, w.log, w.opts.wOpts...) - w.legacyFilter = legacy_filter.NewWakuFilter(w.bcaster, w.opts.isLegacyFilterFullNode, w.timesource, w.log, w.opts.legacyFilterOpts...) - w.filterFullNode = filter.NewWakuFilterFullNode(w.timesource, w.log, w.opts.filterOpts...) - w.filterLightNode = filter.NewWakuFilterLightNode(w.bcaster, w.peermanager, w.timesource, w.log) - w.lightPush = lightpush.NewWakuLightPush(w.Relay(), w.peermanager, w.log) + w.relay = relay.NewWakuRelay(w.bcaster, w.opts.minRelayPeersToPublish, w.timesource, w.opts.prometheusReg, w.log, w.opts.pubsubOpts...) + w.legacyFilter = legacy_filter.NewWakuFilter(w.bcaster, w.opts.isLegacyFilterFullNode, w.timesource, w.opts.prometheusReg, w.log, w.opts.legacyFilterOpts...) + w.filterFullNode = filter.NewWakuFilterFullNode(w.timesource, w.opts.prometheusReg, w.log, w.opts.filterOpts...) + w.filterLightNode = filter.NewWakuFilterLightNode(w.bcaster, w.peermanager, w.timesource, w.opts.prometheusReg, w.log) + w.lightPush = lightpush.NewWakuLightPush(w.Relay(), w.peermanager, w.opts.prometheusReg, w.log) if params.storeFactory != nil { w.storeFactory = params.storeFactory @@ -362,7 +364,7 @@ func (w *WakuNode) Start(ctx context.Context) error { return err } - w.connectionNotif = NewConnectionNotifier(ctx, w.host, w.opts.connNotifCh, w.log) + w.connectionNotif = NewConnectionNotifier(ctx, w.host, w.opts.connNotifCh, w.metrics, w.log) w.host.Network().Notify(w.connectionNotif) w.enrChangeCh = make(chan struct{}, 10) @@ -665,7 +667,7 @@ func (w *WakuNode) mountDiscV5() error { } var err error - w.discoveryV5, err = discv5.NewDiscoveryV5(w.opts.privKey, w.localNode, w.peerConnector, w.log, discV5Options...) + w.discoveryV5, err = discv5.NewDiscoveryV5(w.opts.privKey, w.localNode, w.peerConnector, w.opts.prometheusReg, w.log, discV5Options...) return err } @@ -735,7 +737,9 @@ func (w *WakuNode) connect(ctx context.Context, info peer.AddrInfo) error { } w.host.Peerstore().(wps.WakuPeerstore).ResetConnFailures(info) - stats.Record(ctx, metrics.Dials.M(1)) + + w.metrics.RecordDial() + return nil } diff --git a/waku/v2/node/wakunode2_test.go b/waku/v2/node/wakunode2_test.go index c62015fe..eabfa5a4 100644 --- a/waku/v2/node/wakunode2_test.go +++ b/waku/v2/node/wakunode2_test.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enode" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/persistence" @@ -232,7 +233,7 @@ func TestDecoupledStoreFromRelay(t *testing.T) { // NODE2: Filter Client/Store db, err := sqlite.NewDB(":memory:", false, utils.Logger()) require.NoError(t, err) - dbStore, err := persistence.NewDBStore(utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) + dbStore, err := persistence.NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) require.NoError(t, err) hostAddr2, err := net.ResolveTCPAddr("tcp", "0.0.0.0:0") diff --git a/waku/v2/node/wakuoptions.go b/waku/v2/node/wakuoptions.go index a71d9f19..f6319067 100644 --- a/waku/v2/node/wakuoptions.go +++ b/waku/v2/node/wakuoptions.go @@ -27,6 +27,7 @@ import ( "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr/net" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/waku/v2/protocol/filter" "github.com/waku-org/go-waku/waku/v2/protocol/legacy_filter" "github.com/waku-org/go-waku/waku/v2/protocol/pb" @@ -53,6 +54,7 @@ type WakuNodeParameters struct { privKey *ecdsa.PrivateKey libP2POpts []libp2p.Option peerstore peerstore.Peerstore + prometheusReg prometheus.Registerer enableNTP bool ntpURLs []string @@ -73,7 +75,7 @@ type WakuNodeParameters struct { enableFilterFullNode bool legacyFilterOpts []legacy_filter.Option filterOpts []filter.Option - wOpts []pubsub.Option + pubsubOpts []pubsub.Option minRelayPeersToPublish int @@ -121,6 +123,7 @@ type WakuNodeOption func(*WakuNodeParameters) error // Default options used in the libp2p node var DefaultWakuNodeOptions = []WakuNodeOption{ + WithPrometheusRegisterer(prometheus.NewRegistry()), WithMaxPeerConnections(50), } @@ -162,6 +165,18 @@ func WithLogLevel(lvl zapcore.Level) WakuNodeOption { } } +// WithPrometheusRegisterer configures go-waku to use reg as the Registerer for all metrics subsystems +func WithPrometheusRegisterer(reg prometheus.Registerer) WakuNodeOption { + return func(params *WakuNodeParameters) error { + if reg == nil { + return errors.New("registerer cannot be nil") + } + + params.prometheusReg = reg + return nil + } +} + // WithDns4Domain is a WakuNodeOption that adds a custom domain name to listen func WithDns4Domain(dns4Domain string) WakuNodeOption { return func(params *WakuNodeParameters) error { @@ -327,7 +342,7 @@ func WithWakuRelay(opts ...pubsub.Option) WakuNodeOption { func WithWakuRelayAndMinPeers(minRelayPeersToPublish int, opts ...pubsub.Option) WakuNodeOption { return func(params *WakuNodeParameters) error { params.enableRelay = true - params.wOpts = opts + params.pubsubOpts = opts params.minRelayPeersToPublish = minRelayPeersToPublish return nil } diff --git a/waku/v2/node/wakuoptions_test.go b/waku/v2/node/wakuoptions_test.go index 80b51bd1..10d65bd1 100644 --- a/waku/v2/node/wakuoptions_test.go +++ b/waku/v2/node/wakuoptions_test.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/persistence" @@ -28,7 +29,7 @@ func TestWakuOptions(t *testing.T) { require.NoError(t, err) storeFactory := func(w *WakuNode) store.Store { - return store.NewWakuStore(w.opts.messageProvider, w.peermanager, w.timesource, w.log) + return store.NewWakuStore(w.opts.messageProvider, w.peermanager, w.timesource, prometheus.DefaultRegisterer, w.log) } options := []WakuNodeOption{ diff --git a/waku/v2/protocol/filter/client.go b/waku/v2/protocol/filter/client.go index 48003997..7a4943a5 100644 --- a/waku/v2/protocol/filter/client.go +++ b/waku/v2/protocol/filter/client.go @@ -14,15 +14,14 @@ import ( "github.com/libp2p/go-libp2p/core/peer" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-msgio/pbio" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/filter/pb" wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/protocol/relay" "github.com/waku-org/go-waku/waku/v2/timesource" - "go.opencensus.io/tag" "go.uber.org/zap" ) @@ -40,6 +39,7 @@ type WakuFilterLightNode struct { h host.Host broadcaster relay.Broadcaster timesource timesource.Timesource + metrics Metrics wg *sync.WaitGroup log *zap.Logger subscriptions *SubscriptionsMap @@ -60,13 +60,14 @@ type WakuFilterPushResult struct { // Takes an optional peermanager if WakuFilterLightnode is being created along with WakuNode. // If using libp2p host, then pass peermanager as nil func NewWakuFilterLightNode(broadcaster relay.Broadcaster, pm *peermanager.PeerManager, - timesource timesource.Timesource, log *zap.Logger) *WakuFilterLightNode { + timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger) *WakuFilterLightNode { wf := new(WakuFilterLightNode) wf.log = log.Named("filterv2-lightnode") wf.broadcaster = broadcaster wf.timesource = timesource wf.wg = &sync.WaitGroup{} wf.pm = pm + wf.metrics = newMetrics(reg) return wf } @@ -79,12 +80,6 @@ func (wf *WakuFilterLightNode) SetHost(h host.Host) { func (wf *WakuFilterLightNode) Start(ctx context.Context) error { wf.wg.Wait() // Wait for any goroutines to stop - ctx, err := tag.New(ctx, tag.Insert(metrics.KeyType, "filter")) - if err != nil { - wf.log.Error("creating tag map", zap.Error(err)) - return errors.New("could not start waku filter") - } - ctx, cancel := context.WithCancel(ctx) wf.cancel = cancel wf.ctx = ctx @@ -121,7 +116,7 @@ func (wf *WakuFilterLightNode) onRequest(ctx context.Context) func(s network.Str if !wf.subscriptions.IsSubscribedTo(s.Conn().RemotePeer()) { logger.Warn("received message push from unknown peer", logging.HostID("peerID", s.Conn().RemotePeer())) - metrics.RecordFilterError(ctx, "unknown_peer_messagepush") + wf.metrics.RecordError(unknownPeerMessagePush) return } @@ -131,17 +126,17 @@ func (wf *WakuFilterLightNode) onRequest(ctx context.Context) func(s network.Str err := reader.ReadMsg(messagePush) if err != nil { logger.Error("reading message push", zap.Error(err)) - metrics.RecordFilterError(ctx, "decode_rpc_failure") + wf.metrics.RecordError(decodeRPCFailure) return } if !wf.subscriptions.Has(s.Conn().RemotePeer(), messagePush.PubsubTopic, messagePush.WakuMessage.ContentTopic) { logger.Warn("received messagepush with invalid subscription parameters", logging.HostID("peerID", s.Conn().RemotePeer()), zap.String("topic", messagePush.PubsubTopic), zap.String("contentTopic", messagePush.WakuMessage.ContentTopic)) - metrics.RecordFilterError(ctx, "invalid_subscription_message") + wf.metrics.RecordError(invalidSubscriptionMessage) return } - metrics.RecordFilterMessage(ctx, "PushMessage", 1) + wf.metrics.RecordMessage() wf.notify(s.Conn().RemotePeer(), messagePush.PubsubTopic, messagePush.WakuMessage) @@ -162,7 +157,7 @@ func (wf *WakuFilterLightNode) notify(remotePeerID peer.ID, pubsubTopic string, func (wf *WakuFilterLightNode) request(ctx context.Context, params *FilterSubscribeParameters, reqType pb.FilterSubscribeRequest_FilterSubscribeType, contentFilter ContentFilter) error { conn, err := wf.h.NewStream(ctx, params.selectedPeer, FilterSubscribeID_v20beta1) if err != nil { - metrics.RecordFilterError(ctx, "dial_failure") + wf.metrics.RecordError(dialFailure) return err } defer conn.Close() @@ -180,7 +175,7 @@ func (wf *WakuFilterLightNode) request(ctx context.Context, params *FilterSubscr wf.log.Debug("sending FilterSubscribeRequest", zap.Stringer("request", request)) err = writer.WriteMsg(request) if err != nil { - metrics.RecordFilterError(ctx, "write_request_failure") + wf.metrics.RecordError(writeRequestFailure) wf.log.Error("sending FilterSubscribeRequest", zap.Error(err)) return err } @@ -189,19 +184,19 @@ func (wf *WakuFilterLightNode) request(ctx context.Context, params *FilterSubscr err = reader.ReadMsg(filterSubscribeResponse) if err != nil { wf.log.Error("receiving FilterSubscribeResponse", zap.Error(err)) - metrics.RecordFilterError(ctx, "decode_rpc_failure") + wf.metrics.RecordError(decodeRPCFailure) return err } if filterSubscribeResponse.RequestId != request.RequestId { wf.log.Error("requestID mismatch", zap.String("expected", request.RequestId), zap.String("received", filterSubscribeResponse.RequestId)) - metrics.RecordFilterError(ctx, "request_id_mismatch") + wf.metrics.RecordError(requestIDMismatch) err := NewFilterError(300, "request_id_mismatch") return &err } if filterSubscribeResponse.StatusCode != http.StatusOK { - metrics.RecordFilterError(ctx, "error_response") + wf.metrics.RecordError(errorResponse) err := NewFilterError(int(filterSubscribeResponse.StatusCode), filterSubscribeResponse.StatusDesc) return &err } @@ -235,7 +230,7 @@ func (wf *WakuFilterLightNode) Subscribe(ctx context.Context, contentFilter Cont } if params.selectedPeer == "" { - metrics.RecordFilterError(ctx, "peer_not_found_failure") + wf.metrics.RecordError(peerNotFoundFailure) return nil, ErrNoPeersAvailable } diff --git a/waku/v2/protocol/filter/filter_test.go b/waku/v2/protocol/filter/filter_test.go index 1daf9884..5e676bad 100644 --- a/waku/v2/protocol/filter/filter_test.go +++ b/waku/v2/protocol/filter/filter_test.go @@ -11,6 +11,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/suite" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol" @@ -54,7 +55,7 @@ func (s *FilterTestSuite) makeWakuRelay(topic string) (*relay.WakuRelay, *relay. host, err := tests.MakeHost(context.Background(), port, rand.Reader) s.Require().NoError(err) - relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), s.log) + relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, s.log) relay.SetHost(host) s.fullNodeHost = host err = relay.Start(context.Background()) @@ -75,7 +76,7 @@ func (s *FilterTestSuite) makeWakuFilterLightNode() *WakuFilterLightNode { b := relay.NewBroadcaster(10) s.Require().NoError(b.Start(context.Background())) - filterPush := NewWakuFilterLightNode(b, nil, timesource.NewDefaultClock(), s.log) + filterPush := NewWakuFilterLightNode(b, nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, s.log) filterPush.SetHost(host) s.lightNodeHost = host err = filterPush.Start(context.Background()) @@ -88,7 +89,7 @@ func (s *FilterTestSuite) makeWakuFilterFullNode(topic string) (*relay.WakuRelay node, relaySub, host, broadcaster := s.makeWakuRelay(topic) s.relaySub = relaySub - node2Filter := NewWakuFilterFullNode(timesource.NewDefaultClock(), s.log) + node2Filter := NewWakuFilterFullNode(timesource.NewDefaultClock(), prometheus.DefaultRegisterer, s.log) node2Filter.SetHost(host) sub := broadcaster.Register(topic) err := node2Filter.Start(s.ctx, sub) diff --git a/waku/v2/protocol/filter/metrics.go b/waku/v2/protocol/filter/metrics.go new file mode 100644 index 00000000..51e3b356 --- /dev/null +++ b/waku/v2/protocol/filter/metrics.go @@ -0,0 +1,120 @@ +package filter + +import ( + "time" + + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var filterMessages = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_filter_messages", + Help: "The number of messages received via filter protocol", + }) + +var filterErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_filter_errors", + Help: "The distribution of the filter protocol errors", + }, + []string{"error_type"}, +) + +var filterRequests = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_filter_requests", + Help: "The distribution of filter requests", + }, + []string{"request_type"}, +) + +var filterRequestDurationSeconds = prometheus.NewHistogramVec( + prometheus.HistogramOpts{ + Name: "waku_filter_request_duration_seconds", + Help: "Duration of Filter Subscribe Requests", + }, + []string{"request_type"}, +) + +var filterHandleMessageDurationSeconds = prometheus.NewHistogram( + prometheus.HistogramOpts{ + Name: "waku_filter_handle_message_duration_seconds", + Help: "Duration to Push Message to Filter Subscribers", + }) + +var filterSubscriptions = prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "waku_filter_subscriptions", + Help: "The number of filter subscriptions", + }) + +var collectors = []prometheus.Collector{ + filterMessages, + filterErrors, + filterRequests, + filterSubscriptions, + filterRequestDurationSeconds, + filterHandleMessageDurationSeconds, +} + +// Metrics exposes the functions required to update prometheus metrics for filter protocol +type Metrics interface { + RecordMessage() + RecordRequest(requestType string, duration time.Duration) + RecordPushDuration(duration time.Duration) + RecordSubscriptions(num int) + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +// RecordMessage is used to increase the counter for the number of messages received via waku filter +func (m *metricsImpl) RecordMessage() { + filterMessages.Inc() +} + +type metricsErrCategory string + +var ( + unknownPeerMessagePush metricsErrCategory = "unknown_peer_messagepush" + decodeRPCFailure metricsErrCategory = "decode_rpc_failure" + invalidSubscriptionMessage metricsErrCategory = "invalid_subscription_message" + dialFailure metricsErrCategory = "dial_failure" + writeRequestFailure metricsErrCategory = "write_request_failure" + requestIDMismatch metricsErrCategory = "request_id_mismatch" + errorResponse metricsErrCategory = "error_response" + peerNotFoundFailure metricsErrCategory = "peer_not_found_failure" + writeResponseFailure metricsErrCategory = "write_response_failure" + pushTimeoutFailure metricsErrCategory = "push_timeout_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + filterErrors.WithLabelValues(string(err)).Inc() +} + +// RecordRequest tracks the duration of each type of filter request received +func (m *metricsImpl) RecordRequest(requestType string, duration time.Duration) { + filterRequests.WithLabelValues(requestType).Inc() + filterRequestDurationSeconds.WithLabelValues(requestType).Observe(duration.Seconds()) +} + +// RecordPushDuration tracks the duration of pushing a message to a filter subscriber +func (m *metricsImpl) RecordPushDuration(duration time.Duration) { + filterHandleMessageDurationSeconds.Observe(duration.Seconds()) +} + +// RecordSubscriptions track the current number of filter subscriptions +func (m *metricsImpl) RecordSubscriptions(num int) { + filterSubscriptions.Set(float64(num)) +} diff --git a/waku/v2/protocol/filter/server.go b/waku/v2/protocol/filter/server.go index 371fa0e9..c4c7cfb6 100644 --- a/waku/v2/protocol/filter/server.go +++ b/waku/v2/protocol/filter/server.go @@ -14,14 +14,12 @@ import ( "github.com/libp2p/go-libp2p/core/peer" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-msgio/pbio" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/filter/pb" "github.com/waku-org/go-waku/waku/v2/protocol/relay" "github.com/waku-org/go-waku/waku/v2/timesource" - "go.opencensus.io/stats" - "go.opencensus.io/tag" "go.uber.org/zap" ) @@ -33,11 +31,12 @@ const peerHasNoSubscription = "peer has no subscriptions" type ( WakuFilterFullNode struct { - cancel context.CancelFunc - h host.Host - msgSub relay.Subscription - wg *sync.WaitGroup - log *zap.Logger + cancel context.CancelFunc + h host.Host + msgSub relay.Subscription + metrics Metrics + wg *sync.WaitGroup + log *zap.Logger subscriptions *SubscribersMap @@ -46,7 +45,7 @@ type ( ) // NewWakuFilterFullNode returns a new instance of Waku Filter struct setup according to the chosen parameter and options -func NewWakuFilterFullNode(timesource timesource.Timesource, log *zap.Logger, opts ...Option) *WakuFilterFullNode { +func NewWakuFilterFullNode(timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger, opts ...Option) *WakuFilterFullNode { wf := new(WakuFilterFullNode) wf.log = log.Named("filterv2-fullnode") @@ -58,6 +57,7 @@ func NewWakuFilterFullNode(timesource timesource.Timesource, log *zap.Logger, op } wf.wg = &sync.WaitGroup{} + wf.metrics = newMetrics(reg) wf.subscriptions = NewSubscribersMap(params.Timeout) wf.maxSubscriptions = params.MaxSubscribers @@ -72,12 +72,6 @@ func (wf *WakuFilterFullNode) SetHost(h host.Host) { func (wf *WakuFilterFullNode) Start(ctx context.Context, sub relay.Subscription) error { wf.wg.Wait() // Wait for any goroutines to stop - ctx, err := tag.New(ctx, tag.Insert(metrics.KeyType, "filter")) - if err != nil { - wf.log.Error("creating tag map", zap.Error(err)) - return errors.New("could not start waku filter") - } - ctx, cancel := context.WithCancel(ctx) wf.h.SetStreamHandlerMatch(FilterSubscribeID_v20beta1, protocol.PrefixTextMatch(string(FilterSubscribeID_v20beta1)), wf.onRequest(ctx)) @@ -102,7 +96,7 @@ func (wf *WakuFilterFullNode) onRequest(ctx context.Context) func(s network.Stre subscribeRequest := &pb.FilterSubscribeRequest{} err := reader.ReadMsg(subscribeRequest) if err != nil { - metrics.RecordFilterError(ctx, "decode_rpc_failure") + wf.metrics.RecordError(decodeRPCFailure) logger.Error("reading request", zap.Error(err)) return } @@ -122,13 +116,13 @@ func (wf *WakuFilterFullNode) onRequest(ctx context.Context) func(s network.Stre wf.unsubscribeAll(ctx, s, logger, subscribeRequest) } - metrics.RecordFilterRequest(ctx, subscribeRequest.FilterSubscribeType.String(), time.Since(start)) + wf.metrics.RecordRequest(subscribeRequest.FilterSubscribeType.String(), time.Since(start)) logger.Info("received request") } } -func reply(ctx context.Context, s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequest, statusCode int, description ...string) { +func (wf *WakuFilterFullNode) reply(ctx context.Context, s network.Stream, request *pb.FilterSubscribeRequest, statusCode int, description ...string) { response := &pb.FilterSubscribeResponse{ RequestId: request.RequestId, StatusCode: uint32(statusCode), @@ -143,8 +137,8 @@ func reply(ctx context.Context, s network.Stream, logger *zap.Logger, request *p writer := pbio.NewDelimitedWriter(s) err := writer.WriteMsg(response) if err != nil { - metrics.RecordFilterError(ctx, "write_response_failure") - logger.Error("sending response", zap.Error(err)) + wf.metrics.RecordError(writeResponseFailure) + wf.log.Error("sending response", zap.Error(err)) } } @@ -152,29 +146,29 @@ func (wf *WakuFilterFullNode) ping(ctx context.Context, s network.Stream, logger exists := wf.subscriptions.Has(s.Conn().RemotePeer()) if exists { - reply(ctx, s, logger, request, http.StatusOK) + wf.reply(ctx, s, request, http.StatusOK) } else { - reply(ctx, s, logger, request, http.StatusNotFound, peerHasNoSubscription) + wf.reply(ctx, s, request, http.StatusNotFound, peerHasNoSubscription) } } func (wf *WakuFilterFullNode) subscribe(ctx context.Context, s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequest) { if request.PubsubTopic == "" { - reply(ctx, s, logger, request, http.StatusBadRequest, "pubsubtopic can't be empty") + wf.reply(ctx, s, request, http.StatusBadRequest, "pubsubtopic can't be empty") return } if len(request.ContentTopics) == 0 { - reply(ctx, s, logger, request, http.StatusBadRequest, "at least one contenttopic should be specified") + wf.reply(ctx, s, request, http.StatusBadRequest, "at least one contenttopic should be specified") return } if len(request.ContentTopics) > MaxContentTopicsPerRequest { - reply(ctx, s, logger, request, http.StatusBadRequest, fmt.Sprintf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)) + wf.reply(ctx, s, request, http.StatusBadRequest, fmt.Sprintf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)) } if wf.subscriptions.Count() >= wf.maxSubscriptions { - reply(ctx, s, logger, request, http.StatusServiceUnavailable, "node has reached maximum number of subscriptions") + wf.reply(ctx, s, request, http.StatusServiceUnavailable, "node has reached maximum number of subscriptions") return } @@ -187,49 +181,48 @@ func (wf *WakuFilterFullNode) subscribe(ctx context.Context, s network.Stream, l } if ctTotal+len(request.ContentTopics) > MaxCriteriaPerSubscription { - reply(ctx, s, logger, request, http.StatusServiceUnavailable, "peer has reached maximum number of filter criteria") + wf.reply(ctx, s, request, http.StatusServiceUnavailable, "peer has reached maximum number of filter criteria") return } } wf.subscriptions.Set(peerID, request.PubsubTopic, request.ContentTopics) - stats.Record(ctx, metrics.FilterSubscriptions.M(int64(wf.subscriptions.Count()))) - - reply(ctx, s, logger, request, http.StatusOK) + wf.metrics.RecordSubscriptions(wf.subscriptions.Count()) + wf.reply(ctx, s, request, http.StatusOK) } func (wf *WakuFilterFullNode) unsubscribe(ctx context.Context, s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequest) { if request.PubsubTopic == "" { - reply(ctx, s, logger, request, http.StatusBadRequest, "pubsubtopic can't be empty") + wf.reply(ctx, s, request, http.StatusBadRequest, "pubsubtopic can't be empty") return } if len(request.ContentTopics) == 0 { - reply(ctx, s, logger, request, http.StatusBadRequest, "at least one contenttopic should be specified") + wf.reply(ctx, s, request, http.StatusBadRequest, "at least one contenttopic should be specified") return } if len(request.ContentTopics) > MaxContentTopicsPerRequest { - reply(ctx, s, logger, request, http.StatusBadRequest, fmt.Sprintf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)) + wf.reply(ctx, s, request, http.StatusBadRequest, fmt.Sprintf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)) } err := wf.subscriptions.Delete(s.Conn().RemotePeer(), request.PubsubTopic, request.ContentTopics) if err != nil { - reply(ctx, s, logger, request, http.StatusNotFound, peerHasNoSubscription) + wf.reply(ctx, s, request, http.StatusNotFound, peerHasNoSubscription) } else { - stats.Record(ctx, metrics.FilterSubscriptions.M(int64(wf.subscriptions.Count()))) - reply(ctx, s, logger, request, http.StatusOK) + wf.metrics.RecordSubscriptions(wf.subscriptions.Count()) + wf.reply(ctx, s, request, http.StatusOK) } } func (wf *WakuFilterFullNode) unsubscribeAll(ctx context.Context, s network.Stream, logger *zap.Logger, request *pb.FilterSubscribeRequest) { err := wf.subscriptions.DeleteAll(s.Conn().RemotePeer()) if err != nil { - reply(ctx, s, logger, request, http.StatusNotFound, peerHasNoSubscription) + wf.reply(ctx, s, request, http.StatusNotFound, peerHasNoSubscription) } else { - stats.Record(ctx, metrics.FilterSubscriptions.M(int64(wf.subscriptions.Count()))) - reply(ctx, s, logger, request, http.StatusOK) + wf.metrics.RecordSubscriptions(wf.subscriptions.Count()) + wf.reply(ctx, s, request, http.StatusOK) } } @@ -259,8 +252,7 @@ func (wf *WakuFilterFullNode) filterListener(ctx context.Context) { logger.Error("pushing message", zap.Error(err)) return } - ellapsed := time.Since(start) - metrics.FilterHandleMessageDurationSeconds.M(int64(ellapsed.Seconds())) + wf.metrics.RecordPushDuration(time.Since(start)) }(subscriber) } @@ -289,9 +281,9 @@ func (wf *WakuFilterFullNode) pushMessage(ctx context.Context, peerID peer.ID, e if err != nil { wf.subscriptions.FlagAsFailure(peerID) if errors.Is(context.DeadlineExceeded, err) { - metrics.RecordFilterError(ctx, "push_timeout_failure") + wf.metrics.RecordError(pushTimeoutFailure) } else { - metrics.RecordFilterError(ctx, "dial_failure") + wf.metrics.RecordError(dialFailure) } logger.Error("opening peer stream", zap.Error(err)) return err @@ -302,9 +294,9 @@ func (wf *WakuFilterFullNode) pushMessage(ctx context.Context, peerID peer.ID, e err = writer.WriteMsg(messagePush) if err != nil { if errors.Is(context.DeadlineExceeded, err) { - metrics.RecordFilterError(ctx, "push_timeout_failure") + wf.metrics.RecordError(pushTimeoutFailure) } else { - metrics.RecordFilterError(ctx, "response_write_failure") + wf.metrics.RecordError(writeResponseFailure) } logger.Error("pushing messages to peer", zap.Error(err)) wf.subscriptions.FlagAsFailure(peerID) diff --git a/waku/v2/protocol/legacy_filter/metrics.go b/waku/v2/protocol/legacy_filter/metrics.go new file mode 100644 index 00000000..abb59822 --- /dev/null +++ b/waku/v2/protocol/legacy_filter/metrics.go @@ -0,0 +1,75 @@ +package legacy_filter + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var filterMessages = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "legacy_filter_messages", + Help: "The number of messages received via legacy filter protocol", + }) + +var filterErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "legacy_filter_errors", + Help: "The distribution of the legacy filter protocol errors", + }, + []string{"error_type"}, +) + +var filterSubscribers = prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "legacy_filter_subscriptions", + Help: "The number of legacy filter subscribers", + }) + +var collectors = []prometheus.Collector{ + filterMessages, + filterErrors, + filterSubscribers, +} + +// Metrics exposes the functions required to update prometheus metrics for legacy filter protocol +type Metrics interface { + RecordMessages(num int) + RecordSubscribers(num int) + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +// RecordMessage is used to increase the counter for the number of messages received via waku filter +func (m *metricsImpl) RecordMessages(num int) { + filterMessages.Add(float64(num)) +} + +type metricsErrCategory string + +var ( + decodeRPCFailure metricsErrCategory = "decode_rpc_failure" + dialFailure metricsErrCategory = "dial_failure" + pushWriteError metricsErrCategory = "push_write_error" + peerNotFoundFailure metricsErrCategory = "peer_not_found_failure" + writeRequestFailure metricsErrCategory = "write_request_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + filterErrors.WithLabelValues(string(err)).Inc() +} + +// RecordSubscribers track the current number of filter subscribers +func (m *metricsImpl) RecordSubscribers(num int) { + filterSubscribers.Set(float64(num)) +} diff --git a/waku/v2/protocol/legacy_filter/waku_filter.go b/waku/v2/protocol/legacy_filter/waku_filter.go index f9f3a01d..875f11bb 100644 --- a/waku/v2/protocol/legacy_filter/waku_filter.go +++ b/waku/v2/protocol/legacy_filter/waku_filter.go @@ -12,15 +12,13 @@ import ( "github.com/libp2p/go-libp2p/core/peer" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-msgio/pbio" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/legacy_filter/pb" wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/protocol/relay" "github.com/waku-org/go-waku/waku/v2/timesource" - "go.opencensus.io/stats" - "go.opencensus.io/tag" "go.uber.org/zap" "golang.org/x/sync/errgroup" ) @@ -53,6 +51,7 @@ type ( h host.Host isFullNode bool msgSub relay.Subscription + metrics Metrics wg *sync.WaitGroup log *zap.Logger @@ -65,7 +64,7 @@ type ( const FilterID_v20beta1 = libp2pProtocol.ID("/vac/waku/filter/2.0.0-beta1") // NewWakuRelay returns a new instance of Waku Filter struct setup according to the chosen parameter and options -func NewWakuFilter(broadcaster relay.Broadcaster, isFullNode bool, timesource timesource.Timesource, log *zap.Logger, opts ...Option) *WakuFilter { +func NewWakuFilter(broadcaster relay.Broadcaster, isFullNode bool, timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger, opts ...Option) *WakuFilter { wf := new(WakuFilter) wf.log = log.Named("filter").With(zap.Bool("fullNode", isFullNode)) @@ -80,6 +79,7 @@ func NewWakuFilter(broadcaster relay.Broadcaster, isFullNode bool, timesource ti wf.isFullNode = isFullNode wf.filters = NewFilterMap(broadcaster, timesource) wf.subscribers = NewSubscribers(params.Timeout) + wf.metrics = newMetrics(reg) return wf } @@ -92,12 +92,6 @@ func (wf *WakuFilter) SetHost(h host.Host) { func (wf *WakuFilter) Start(ctx context.Context, sub relay.Subscription) error { wf.wg.Wait() // Wait for any goroutines to stop - ctx, err := tag.New(ctx, tag.Insert(metrics.KeyType, "filter")) - if err != nil { - wf.log.Error("creating tag map", zap.Error(err)) - return errors.New("could not start waku filter") - } - ctx, cancel := context.WithCancel(ctx) wf.h.SetStreamHandlerMatch(FilterID_v20beta1, protocol.PrefixTextMatch(string(FilterID_v20beta1)), wf.onRequest(ctx)) @@ -124,7 +118,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) { err := reader.ReadMsg(filterRPCRequest) if err != nil { - metrics.RecordLegacyFilterError(ctx, "decode_rpc_failure") + wf.metrics.RecordError(decodeRPCFailure) logger.Error("reading request", zap.Error(err)) return } @@ -139,7 +133,7 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) { } logger.Info("received a message push", zap.Int("messages", len(filterRPCRequest.Push.Messages))) - metrics.RecordLegacyFilterMessage(ctx, "FilterRequest", len(filterRPCRequest.Push.Messages)) + wf.metrics.RecordMessages(len(filterRPCRequest.Push.Messages)) } else if filterRPCRequest.Request != nil && wf.isFullNode { // We're on a full node. // This is a filter request coming from a light node. @@ -152,13 +146,13 @@ func (wf *WakuFilter) onRequest(ctx context.Context) func(s network.Stream) { len := wf.subscribers.Append(subscriber) logger.Info("adding subscriber") - stats.Record(ctx, metrics.LegacyFilterSubscribers.M(int64(len))) + wf.metrics.RecordSubscribers(len) } else { peerId := s.Conn().RemotePeer() wf.subscribers.RemoveContentFilters(peerId, filterRPCRequest.RequestId, filterRPCRequest.Request.ContentFilters) logger.Info("removing subscriber") - stats.Record(ctx, metrics.LegacyFilterSubscribers.M(int64(wf.subscribers.Length()))) + wf.metrics.RecordSubscribers(wf.subscribers.Length()) } } else { logger.Error("can't serve request") @@ -175,7 +169,7 @@ func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, ms if err != nil { wf.subscribers.FlagAsFailure(subscriber.peer) logger.Error("opening peer stream", zap.Error(err)) - metrics.RecordLegacyFilterError(ctx, "dial_failure") + wf.metrics.RecordError(dialFailure) return err } @@ -185,7 +179,7 @@ func (wf *WakuFilter) pushMessage(ctx context.Context, subscriber Subscriber, ms if err != nil { logger.Error("pushing messages to peer", zap.Error(err)) wf.subscribers.FlagAsFailure(subscriber.peer) - metrics.RecordLegacyFilterError(ctx, "push_write_error") + wf.metrics.RecordError(pushWriteError) return nil } @@ -251,7 +245,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil } if params.selectedPeer == "" { - metrics.RecordLegacyFilterError(ctx, "peer_not_found_failure") + wf.metrics.RecordError(peerNotFoundFailure) return nil, ErrNoPeersAvailable } @@ -269,7 +263,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil var conn network.Stream conn, err = wf.h.NewStream(ctx, params.selectedPeer, FilterID_v20beta1) if err != nil { - metrics.RecordLegacyFilterError(ctx, "dial_failure") + wf.metrics.RecordError(dialFailure) return } @@ -283,7 +277,7 @@ func (wf *WakuFilter) requestSubscription(ctx context.Context, filter ContentFil wf.log.Debug("sending filterRPC", zap.Stringer("rpc", filterRPC)) err = writer.WriteMsg(filterRPC) if err != nil { - metrics.RecordLegacyFilterError(ctx, "request_write_error") + wf.metrics.RecordError(writeRequestFailure) wf.log.Error("sending filterRPC", zap.Error(err)) return } @@ -300,7 +294,7 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt conn, err := wf.h.NewStream(ctx, peer, FilterID_v20beta1) if err != nil { - metrics.RecordLegacyFilterError(ctx, "dial_failure") + wf.metrics.RecordError(dialFailure) return err } @@ -324,7 +318,7 @@ func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilt filterRPC := &pb.FilterRPC{RequestId: hex.EncodeToString(id), Request: request} err = writer.WriteMsg(filterRPC) if err != nil { - metrics.RecordLegacyFilterError(ctx, "request_write_error") + wf.metrics.RecordError(writeRequestFailure) return err } diff --git a/waku/v2/protocol/legacy_filter/waku_filter_test.go b/waku/v2/protocol/legacy_filter/waku_filter_test.go index 3d488a9b..f40783a2 100644 --- a/waku/v2/protocol/legacy_filter/waku_filter_test.go +++ b/waku/v2/protocol/legacy_filter/waku_filter_test.go @@ -9,6 +9,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol/relay" @@ -23,7 +24,7 @@ func makeWakuRelay(t *testing.T, topic string, broadcaster relay.Broadcaster) (* host, err := tests.MakeHost(context.Background(), port, rand.Reader) require.NoError(t, err) - relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(broadcaster, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.Background()) require.NoError(t, err) @@ -43,7 +44,7 @@ func makeWakuFilter(t *testing.T) (*WakuFilter, host.Host) { b := relay.NewBroadcaster(10) require.NoError(t, b.Start(context.Background())) - filter := NewWakuFilter(b, false, timesource.NewDefaultClock(), utils.Logger()) + filter := NewWakuFilter(b, false, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) filter.SetHost(host) err = filter.Start(context.Background(), relay.NoopSubscription()) require.NoError(t, err) @@ -77,7 +78,7 @@ func TestWakuFilter(t *testing.T) { defer node2.Stop() defer sub2.Unsubscribe() - node2Filter := NewWakuFilter(broadcaster, true, timesource.NewDefaultClock(), utils.Logger()) + node2Filter := NewWakuFilter(broadcaster, true, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) node2Filter.SetHost(host2) sub := broadcaster.Register(testTopic) err := node2Filter.Start(ctx, sub) @@ -168,7 +169,7 @@ func TestWakuFilterPeerFailure(t *testing.T) { broadcaster2 := relay.NewBroadcaster(10) require.NoError(t, broadcaster2.Start(context.Background())) - node2Filter := NewWakuFilter(broadcaster2, true, timesource.NewDefaultClock(), utils.Logger(), WithTimeout(3*time.Second)) + node2Filter := NewWakuFilter(broadcaster2, true, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger(), WithTimeout(3*time.Second)) node2Filter.SetHost(host2) sub := broadcaster.Register(testTopic) err := node2Filter.Start(ctx, sub) diff --git a/waku/v2/protocol/lightpush/metrics.go b/waku/v2/protocol/lightpush/metrics.go new file mode 100644 index 00000000..857243b5 --- /dev/null +++ b/waku/v2/protocol/lightpush/metrics.go @@ -0,0 +1,65 @@ +package lightpush + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var lightpushMessages = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_lightpush_messages", + Help: "The number of messages sent via lightpush protocol", + }) + +var lightpushErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_lightpush_errors", + Help: "The distribution of the lightpush protocol errors", + }, + []string{"error_type"}, +) + +var collectors = []prometheus.Collector{ + lightpushMessages, + lightpushErrors, +} + +// Metrics exposes the functions required to update prometheus metrics for lightpush protocol +type Metrics interface { + RecordMessage() + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +// RecordMessage is used to increase the counter for the number of messages received via waku lightpush +func (m *metricsImpl) RecordMessage() { + lightpushMessages.Inc() +} + +type metricsErrCategory string + +var ( + decodeRPCFailure metricsErrCategory = "decode_rpc_failure" + writeRequestFailure metricsErrCategory = "write_request_failure" + writeResponseFailure metricsErrCategory = "write_response_failure" + dialFailure metricsErrCategory = "dial_failure" + messagePushFailure metricsErrCategory = "message_push_failure" + emptyRequestBodyFailure metricsErrCategory = "empty_request_body_failure" + emptyResponseBodyFailure metricsErrCategory = "empty_response_body_failure" + peerNotFoundFailure metricsErrCategory = "peer_not_found_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + lightpushErrors.WithLabelValues(string(err)).Inc() +} diff --git a/waku/v2/protocol/lightpush/waku_lightpush.go b/waku/v2/protocol/lightpush/waku_lightpush.go index 6bc6f0a5..41db0664 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush.go +++ b/waku/v2/protocol/lightpush/waku_lightpush.go @@ -10,8 +10,8 @@ import ( "github.com/libp2p/go-libp2p/core/network" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-msgio/pbio" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/lightpush/pb" @@ -30,10 +30,11 @@ var ( // WakuLightPush is the implementation of the Waku LightPush protocol type WakuLightPush struct { - h host.Host - relay *relay.WakuRelay - cancel context.CancelFunc - pm *peermanager.PeerManager + h host.Host + relay *relay.WakuRelay + cancel context.CancelFunc + pm *peermanager.PeerManager + metrics Metrics log *zap.Logger } @@ -41,11 +42,12 @@ type WakuLightPush struct { // NewWakuLightPush returns a new instance of Waku Lightpush struct // Takes an optional peermanager if WakuLightPush is being created along with WakuNode. // If using libp2p host, then pass peermanager as nil -func NewWakuLightPush(relay *relay.WakuRelay, pm *peermanager.PeerManager, log *zap.Logger) *WakuLightPush { +func NewWakuLightPush(relay *relay.WakuRelay, pm *peermanager.PeerManager, reg prometheus.Registerer, log *zap.Logger) *WakuLightPush { wakuLP := new(WakuLightPush) wakuLP.relay = relay wakuLP.log = log.Named("lightpush") wakuLP.pm = pm + wakuLP.metrics = newMetrics(reg) return wakuLP } @@ -86,7 +88,7 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea err := reader.ReadMsg(requestPushRPC) if err != nil { logger.Error("reading request", zap.Error(err)) - metrics.RecordLightpushError(ctx, "decode_rpc_failure") + wakuLP.metrics.RecordError(decodeRPCFailure) return } @@ -98,7 +100,7 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea pubSubTopic := requestPushRPC.Query.PubsubTopic message := requestPushRPC.Query.Message - metrics.RecordLightpushMessage(ctx, "PushRequest") + wakuLP.metrics.RecordMessage() // TODO: Assumes success, should probably be extended to check for network, peers, etc // It might make sense to use WithReadiness option here? @@ -107,7 +109,7 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea if err != nil { logger.Error("publishing message", zap.Error(err)) - metrics.RecordLightpushError(ctx, "message_push_failure") + wakuLP.metrics.RecordError(messagePushFailure) response.Info = "Could not publish message" } else { response.IsSuccess = true @@ -120,14 +122,14 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea err = writer.WriteMsg(responsePushRPC) if err != nil { - metrics.RecordLightpushError(ctx, "response_write_failure") + wakuLP.metrics.RecordError(writeResponseFailure) logger.Error("writing response", zap.Error(err)) _ = s.Reset() } else { logger.Info("response sent") } } else { - metrics.RecordLightpushError(ctx, "empty_request_body_failure") + wakuLP.metrics.RecordError(emptyRequestBodyFailure) } if requestPushRPC.Response != nil { @@ -137,7 +139,7 @@ func (wakuLP *WakuLightPush) onRequest(ctx context.Context) func(s network.Strea logger.Info("request failure", zap.String("info=", requestPushRPC.Response.Info)) } } else { - metrics.RecordLightpushError(ctx, "empty_response_body_failure") + wakuLP.metrics.RecordError(emptyResponseBodyFailure) } } } @@ -154,7 +156,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o } if params.selectedPeer == "" { - metrics.RecordLightpushError(ctx, "peer_not_found_failure") + wakuLP.metrics.RecordError(peerNotFoundFailure) return nil, ErrNoPeersAvailable } @@ -167,7 +169,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o connOpt, err := wakuLP.h.NewStream(ctx, params.selectedPeer, LightPushID_v20beta1) if err != nil { logger.Error("creating stream to peer", zap.Error(err)) - metrics.RecordLightpushError(ctx, "dial_failure") + wakuLP.metrics.RecordError(dialFailure) return nil, err } @@ -175,7 +177,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o defer func() { err := connOpt.Reset() if err != nil { - metrics.RecordLightpushError(ctx, "dial_failure") + wakuLP.metrics.RecordError(dialFailure) logger.Error("resetting connection", zap.Error(err)) } }() @@ -187,7 +189,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o err = writer.WriteMsg(pushRequestRPC) if err != nil { - metrics.RecordLightpushError(ctx, "request_write_failure") + wakuLP.metrics.RecordError(writeRequestFailure) logger.Error("writing request", zap.Error(err)) return nil, err } @@ -196,7 +198,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o err = reader.ReadMsg(pushResponseRPC) if err != nil { logger.Error("reading response", zap.Error(err)) - metrics.RecordLightpushError(ctx, "decode_rpc_failure") + wakuLP.metrics.RecordError(decodeRPCFailure) return nil, err } diff --git a/waku/v2/protocol/lightpush/waku_lightpush_test.go b/waku/v2/protocol/lightpush/waku_lightpush_test.go index 08cb1609..69168fed 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush_test.go +++ b/waku/v2/protocol/lightpush/waku_lightpush_test.go @@ -9,6 +9,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol" @@ -27,7 +28,7 @@ func makeWakuRelay(t *testing.T, topic string) (*relay.WakuRelay, *relay.Subscri b := relay.NewBroadcaster(10) require.NoError(t, b.Start(context.Background())) - relay := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) require.NoError(t, err) err = relay.Start(context.Background()) @@ -61,7 +62,7 @@ func TestWakuLightPush(t *testing.T) { defer sub2.Unsubscribe() ctx := context.Background() - lightPushNode2 := NewWakuLightPush(node2, nil, utils.Logger()) + lightPushNode2 := NewWakuLightPush(node2, nil, prometheus.DefaultRegisterer, utils.Logger()) lightPushNode2.SetHost(host2) err := lightPushNode2.Start(ctx) require.NoError(t, err) @@ -72,7 +73,7 @@ func TestWakuLightPush(t *testing.T) { clientHost, err := tests.MakeHost(context.Background(), port, rand.Reader) require.NoError(t, err) - client := NewWakuLightPush(nil, nil, utils.Logger()) + client := NewWakuLightPush(nil, nil, prometheus.DefaultRegisterer, utils.Logger()) client.SetHost(clientHost) host2.Peerstore().AddAddr(host1.ID(), tests.GetHostAddress(host1), peerstore.PermanentAddrTTL) @@ -129,7 +130,7 @@ func TestWakuLightPushStartWithoutRelay(t *testing.T) { clientHost, err := tests.MakeHost(context.Background(), 0, rand.Reader) require.NoError(t, err) - client := NewWakuLightPush(nil, nil, utils.Logger()) + client := NewWakuLightPush(nil, nil, prometheus.DefaultRegisterer, utils.Logger()) client.SetHost(clientHost) err = client.Start(ctx) @@ -144,7 +145,7 @@ func TestWakuLightPushNoPeers(t *testing.T) { clientHost, err := tests.MakeHost(context.Background(), 0, rand.Reader) require.NoError(t, err) - client := NewWakuLightPush(nil, nil, utils.Logger()) + client := NewWakuLightPush(nil, nil, prometheus.DefaultRegisterer, utils.Logger()) client.SetHost(clientHost) _, err = client.PublishToTopic(ctx, tests.CreateWakuMessage("test", utils.GetUnixEpoch()), testTopic) require.Errorf(t, err, "no suitable remote peers") diff --git a/waku/v2/protocol/noise/pairing_test.go b/waku/v2/protocol/noise/pairing_test.go index d6692aca..39449db3 100644 --- a/waku/v2/protocol/noise/pairing_test.go +++ b/waku/v2/protocol/noise/pairing_test.go @@ -10,6 +10,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" n "github.com/waku-org/go-noise" "github.com/waku-org/go-waku/tests" @@ -27,7 +28,7 @@ func createRelayNode(t *testing.T) (host.Host, *relay.WakuRelay) { b := relay.NewBroadcaster(1024) require.NoError(t, b.Start(context.Background())) - relay := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(b, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.Background()) require.NoError(t, err) diff --git a/waku/v2/protocol/peer_exchange/client.go b/waku/v2/protocol/peer_exchange/client.go index ff1b6c09..0cdb5a5e 100644 --- a/waku/v2/protocol/peer_exchange/client.go +++ b/waku/v2/protocol/peer_exchange/client.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-msgio/pbio" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/peerstore" wenr "github.com/waku-org/go-waku/waku/v2/protocol/enr" @@ -31,7 +30,7 @@ func (wakuPX *WakuPeerExchange) Request(ctx context.Context, numPeers int, opts } if params.selectedPeer == "" { - metrics.RecordPeerExchangeError(ctx, "dialError") + wakuPX.metrics.RecordError(dialFailure) return ErrNoPeersAvailable } diff --git a/waku/v2/protocol/peer_exchange/metrics.go b/waku/v2/protocol/peer_exchange/metrics.go new file mode 100644 index 00000000..1a98949a --- /dev/null +++ b/waku/v2/protocol/peer_exchange/metrics.go @@ -0,0 +1,47 @@ +package peer_exchange + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var peerExchangeErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "peer_exchange_errors", + Help: "The distribution of the lightpush protocol errors", + }, + []string{"error_type"}, +) + +var collectors = []prometheus.Collector{ + peerExchangeErrors, +} + +// Metrics exposes the functions required to update prometheus metrics for peer_exchange protocol +type Metrics interface { + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +type metricsErrCategory string + +var ( + decodeRPCFailure metricsErrCategory = "decode_rpc_failure" + pxFailure metricsErrCategory = "px_failure" + dialFailure metricsErrCategory = "dial_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + peerExchangeErrors.WithLabelValues(string(err)).Inc() +} diff --git a/waku/v2/protocol/peer_exchange/protocol.go b/waku/v2/protocol/peer_exchange/protocol.go index 832f3198..1b2d739b 100644 --- a/waku/v2/protocol/peer_exchange/protocol.go +++ b/waku/v2/protocol/peer_exchange/protocol.go @@ -12,9 +12,9 @@ import ( "github.com/libp2p/go-libp2p/core/network" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-msgio/pbio" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/logging" "github.com/waku-org/go-waku/waku/v2/discv5" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/enr" @@ -37,10 +37,11 @@ type PeerConnector interface { } type WakuPeerExchange struct { - h host.Host - disc *discv5.DiscoveryV5 - pm *peermanager.PeerManager - log *zap.Logger + h host.Host + disc *discv5.DiscoveryV5 + pm *peermanager.PeerManager + metrics Metrics + log *zap.Logger cancel context.CancelFunc @@ -52,13 +53,14 @@ type WakuPeerExchange struct { // NewWakuPeerExchange returns a new instance of WakuPeerExchange struct // Takes an optional peermanager if WakuPeerExchange is being created along with WakuNode. // If using libp2p host, then pass peermanager as nil -func NewWakuPeerExchange(disc *discv5.DiscoveryV5, peerConnector PeerConnector, pm *peermanager.PeerManager, log *zap.Logger) (*WakuPeerExchange, error) { +func NewWakuPeerExchange(disc *discv5.DiscoveryV5, peerConnector PeerConnector, pm *peermanager.PeerManager, reg prometheus.Registerer, log *zap.Logger) (*WakuPeerExchange, error) { newEnrCache, err := newEnrCache(MaxCacheSize) if err != nil { return nil, err } wakuPX := new(WakuPeerExchange) wakuPX.disc = disc + wakuPX.metrics = newMetrics(reg) wakuPX.log = log.Named("wakupx") wakuPX.enrCache = newEnrCache wakuPX.peerConnector = peerConnector @@ -100,7 +102,7 @@ func (wakuPX *WakuPeerExchange) onRequest(ctx context.Context) func(s network.St err := reader.ReadMsg(requestRPC) if err != nil { logger.Error("reading request", zap.Error(err)) - metrics.RecordPeerExchangeError(ctx, "decodeRpcFailure") + wakuPX.metrics.RecordError(decodeRPCFailure) return } @@ -110,7 +112,7 @@ func (wakuPX *WakuPeerExchange) onRequest(ctx context.Context) func(s network.St records, err := wakuPX.enrCache.getENRs(int(requestRPC.Query.NumPeers)) if err != nil { logger.Error("obtaining enrs from cache", zap.Error(err)) - metrics.RecordPeerExchangeError(ctx, "pxFailure") + wakuPX.metrics.RecordError(pxFailure) return } @@ -122,7 +124,7 @@ func (wakuPX *WakuPeerExchange) onRequest(ctx context.Context) func(s network.St err = writer.WriteMsg(responseRPC) if err != nil { logger.Error("writing response", zap.Error(err)) - metrics.RecordPeerExchangeError(ctx, "pxFailure") + wakuPX.metrics.RecordError(pxFailure) return } } diff --git a/waku/v2/protocol/peer_exchange/waku_peer_exchange_test.go b/waku/v2/protocol/peer_exchange/waku_peer_exchange_test.go index 9f6adc20..695dfc13 100644 --- a/waku/v2/protocol/peer_exchange/waku_peer_exchange_test.go +++ b/waku/v2/protocol/peer_exchange/waku_peer_exchange_test.go @@ -17,6 +17,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peerstore" "github.com/multiformats/go-multiaddr" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/discv5" @@ -107,7 +108,7 @@ func TestRetrieveProvidePeerExchangePeers(t *testing.T) { l1, err := newLocalnode(prvKey1, ip1, udpPort1, wenr.NewWakuEnrBitfield(false, false, false, true), nil, utils.Logger()) require.NoError(t, err) discv5PeerConn1 := tests.NewTestPeerDiscoverer() - d1, err := discv5.NewDiscoveryV5(prvKey1, l1, discv5PeerConn1, utils.Logger(), discv5.WithUDPPort(uint(udpPort1))) + d1, err := discv5.NewDiscoveryV5(prvKey1, l1, discv5PeerConn1, prometheus.DefaultRegisterer, utils.Logger(), discv5.WithUDPPort(uint(udpPort1))) require.NoError(t, err) d1.SetHost(host1) @@ -119,7 +120,7 @@ func TestRetrieveProvidePeerExchangePeers(t *testing.T) { l2, err := newLocalnode(prvKey2, ip2, udpPort2, wenr.NewWakuEnrBitfield(false, false, false, true), nil, utils.Logger()) require.NoError(t, err) discv5PeerConn2 := tests.NewTestPeerDiscoverer() - d2, err := discv5.NewDiscoveryV5(prvKey2, l2, discv5PeerConn2, utils.Logger(), discv5.WithUDPPort(uint(udpPort2)), discv5.WithBootnodes([]*enode.Node{d1.Node()})) + d2, err := discv5.NewDiscoveryV5(prvKey2, l2, discv5PeerConn2, prometheus.DefaultRegisterer, utils.Logger(), discv5.WithUDPPort(uint(udpPort2)), discv5.WithBootnodes([]*enode.Node{d1.Node()})) require.NoError(t, err) d2.SetHost(host2) @@ -142,12 +143,12 @@ func TestRetrieveProvidePeerExchangePeers(t *testing.T) { // mount peer exchange pxPeerConn1 := tests.NewTestPeerDiscoverer() - px1, err := NewWakuPeerExchange(d1, pxPeerConn1, nil, utils.Logger()) + px1, err := NewWakuPeerExchange(d1, pxPeerConn1, nil, prometheus.DefaultRegisterer, utils.Logger()) require.NoError(t, err) px1.SetHost(host1) pxPeerConn3 := tests.NewTestPeerDiscoverer() - px3, err := NewWakuPeerExchange(nil, pxPeerConn3, nil, utils.Logger()) + px3, err := NewWakuPeerExchange(nil, pxPeerConn3, nil, prometheus.DefaultRegisterer, utils.Logger()) require.NoError(t, err) px3.SetHost(host3) diff --git a/waku/v2/protocol/relay/metrics.go b/waku/v2/protocol/relay/metrics.go new file mode 100644 index 00000000..a506d719 --- /dev/null +++ b/waku/v2/protocol/relay/metrics.go @@ -0,0 +1,58 @@ +package relay + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" + "github.com/waku-org/go-waku/logging" + waku_proto "github.com/waku-org/go-waku/waku/v2/protocol" + "go.uber.org/zap" +) + +var messages = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_node_messages", + Help: "The number of the messages received", + }, + []string{"pubsubTopic"}, +) + +var messageSize = prometheus.NewHistogram(prometheus.HistogramOpts{ + Name: "waku_histogram_message_size", + Help: "message size histogram in kB", + Buckets: []float64{0.0, 5.0, 15.0, 50.0, 100.0, 300.0, 700.0, 1000.0}, +}) + +var collectors = []prometheus.Collector{ + messages, + messageSize, +} + +// Metrics exposes the functions required to update prometheus metrics for relay protocol +type Metrics interface { + RecordMessage(envelope *waku_proto.Envelope) +} + +type metricsImpl struct { + log *zap.Logger + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer, logger *zap.Logger) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + log: logger, + reg: reg, + } +} + +// RecordMessage is used to increase the counter for the number of messages received via waku relay +func (m *metricsImpl) RecordMessage(envelope *waku_proto.Envelope) { + go func() { + payloadSizeInBytes := len(envelope.Message().Payload) + payloadSizeInKb := float64(payloadSizeInBytes) / 1000 + messageSize.Observe(payloadSizeInKb) + pubsubTopic := envelope.PubsubTopic() + messages.WithLabelValues(pubsubTopic).Inc() + m.log.Debug("waku.relay received", zap.String("pubsubTopic", pubsubTopic), logging.HexString("hash", envelope.Hash()), zap.Int64("receivedTime", envelope.Index().ReceiverTime), zap.Int("payloadSizeBytes", payloadSizeInBytes)) + }() +} diff --git a/waku/v2/protocol/relay/waku_relay.go b/waku/v2/protocol/relay/waku_relay.go index 5377e06d..8e07d6e6 100644 --- a/waku/v2/protocol/relay/waku_relay.go +++ b/waku/v2/protocol/relay/waku_relay.go @@ -12,8 +12,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" "github.com/libp2p/go-libp2p/p2p/host/eventbus" - "go.opencensus.io/stats" - "go.opencensus.io/tag" + "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" proto "google.golang.org/protobuf/proto" @@ -21,7 +20,6 @@ import ( pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" "github.com/waku-org/go-waku/logging" "github.com/waku-org/go-waku/waku/v2/hash" - "github.com/waku-org/go-waku/waku/v2/metrics" waku_proto "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/timesource" @@ -43,6 +41,7 @@ type WakuRelay struct { peerScoreThresholds *pubsub.PeerScoreThresholds topicParams *pubsub.TopicScoreParams timesource timesource.Timesource + metrics Metrics log *zap.Logger @@ -81,7 +80,7 @@ func msgIdFn(pmsg *pubsub_pb.Message) string { } // NewWakuRelay returns a new instance of a WakuRelay struct -func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource, log *zap.Logger, opts ...pubsub.Option) *WakuRelay { +func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger, opts ...pubsub.Option) *WakuRelay { w := new(WakuRelay) w.timesource = timesource w.wakuRelayTopics = make(map[string]*pubsub.Topic) @@ -91,6 +90,7 @@ func NewWakuRelay(bcaster Broadcaster, minPeersToPublish int, timesource timesou w.wg = sync.WaitGroup{} w.log = log.Named("relay") w.events = eventbus.NewBus() + w.metrics = newMetrics(reg, w.log) cfg := pubsub.DefaultGossipSubParams() cfg.PruneBackoff = time.Minute @@ -455,16 +455,10 @@ func (w *WakuRelay) nextMessage(ctx context.Context, sub *pubsub.Subscription) < func (w *WakuRelay) subscribeToTopic(pubsubTopic string, sub *pubsub.Subscription) { defer w.wg.Done() - ctx, err := tag.New(w.ctx, tag.Insert(metrics.KeyType, "relay")) - if err != nil { - w.log.Error("creating tag map", zap.Error(err)) - return - } - subChannel := w.nextMessage(w.ctx, sub) for { select { - case <-ctx.Done(): + case <-w.ctx.Done(): return // TODO: if there are no more relay subscriptions, close the pubsub subscription case msg, ok := <-subChannel: @@ -477,12 +471,9 @@ func (w *WakuRelay) subscribeToTopic(pubsubTopic string, sub *pubsub.Subscriptio return } - payloadSizeInBytes := len(wakuMessage.Payload) - payloadSizeInKb := payloadSizeInBytes / 1000 - stats.Record(ctx, metrics.Messages.M(1), metrics.MessageSize.M(int64(payloadSizeInKb))) - envelope := waku_proto.NewEnvelope(wakuMessage, w.timesource.Now().UnixNano(), pubsubTopic) - w.log.Debug("waku.relay received", zap.String("pubsubTopic", pubsubTopic), logging.HexString("hash", envelope.Hash()), zap.Int64("receivedTime", envelope.Index().ReceiverTime), zap.Int("payloadSizeBytes", payloadSizeInBytes)) + + w.metrics.RecordMessage(envelope) if w.bcaster != nil { w.bcaster.Submit(envelope) diff --git a/waku/v2/protocol/relay/waku_relay_test.go b/waku/v2/protocol/relay/waku_relay_test.go index 22bbc167..8cddb833 100644 --- a/waku/v2/protocol/relay/waku_relay_test.go +++ b/waku/v2/protocol/relay/waku_relay_test.go @@ -10,6 +10,7 @@ import ( pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol/pb" @@ -25,7 +26,7 @@ func TestWakuRelay(t *testing.T) { host, err := tests.MakeHost(context.Background(), port, rand.Reader) require.NoError(t, err) - relay := NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.Background()) require.NoError(t, err) @@ -66,7 +67,7 @@ func createRelayNode(t *testing.T) (host.Host, *WakuRelay) { host, err := tests.MakeHost(context.Background(), port, rand.Reader) require.NoError(t, err) - relay := NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) return host, relay } diff --git a/waku/v2/protocol/rln/onchain_test.go b/waku/v2/protocol/rln/onchain_test.go index 40e48f41..fd427d11 100644 --- a/waku/v2/protocol/rln/onchain_test.go +++ b/waku/v2/protocol/rln/onchain_test.go @@ -14,6 +14,7 @@ import ( "testing" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-zerokit-rln/rln" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -128,7 +129,7 @@ func (s *WakuRLNRelayDynamicSuite) TestDynamicGroupManagement() { host, err := tests.MakeHost(context.Background(), port, rand.Reader) s.Require().NoError(err) - relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.TODO()) defer relay.Stop() @@ -225,7 +226,7 @@ func (s *WakuRLNRelayDynamicSuite) TestMerkleTreeConstruction() { host, err := tests.MakeHost(context.Background(), port, rand.Reader) s.Require().NoError(err) - relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.TODO()) defer relay.Stop() @@ -271,7 +272,7 @@ func (s *WakuRLNRelayDynamicSuite) TestCorrectRegistrationOfPeers() { host1, err := tests.MakeHost(context.Background(), port1, rand.Reader) s.Require().NoError(err) - relay1 := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay1 := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay1.SetHost(host1) err = relay1.Start(context.TODO()) defer relay1.Stop() @@ -297,7 +298,7 @@ func (s *WakuRLNRelayDynamicSuite) TestCorrectRegistrationOfPeers() { host2, err := tests.MakeHost(context.Background(), port2, rand.Reader) s.Require().NoError(err) - relay2 := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay2 := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay2.SetHost(host2) err = relay2.Start(context.TODO()) defer relay2.Stop() diff --git a/waku/v2/protocol/rln/rln_relay_test.go b/waku/v2/protocol/rln/rln_relay_test.go index e092457b..1c95bed0 100644 --- a/waku/v2/protocol/rln/rln_relay_test.go +++ b/waku/v2/protocol/rln/rln_relay_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/suite" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol/pb" @@ -35,7 +36,7 @@ func (s *WakuRLNRelaySuite) TestOffchainMode() { host, err := tests.MakeHost(context.Background(), port, rand.Reader) s.Require().NoError(err) - relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), utils.Logger()) + relay := relay.NewWakuRelay(nil, 0, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) relay.SetHost(host) err = relay.Start(context.Background()) s.Require().NoError(err) diff --git a/waku/v2/protocol/store/metrics.go b/waku/v2/protocol/store/metrics.go new file mode 100644 index 00000000..d9083ec6 --- /dev/null +++ b/waku/v2/protocol/store/metrics.go @@ -0,0 +1,63 @@ +package store + +import ( + "github.com/libp2p/go-libp2p/p2p/metricshelper" + "github.com/prometheus/client_golang/prometheus" +) + +var storeQueries = prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "waku_store_queries", + Help: "The number of the store queries received", + }) + +var storeErrors = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "waku_store_errors", + Help: "The distribution of the store protocol errors", + }, + []string{"error_type"}, +) + +var collectors = []prometheus.Collector{ + storeQueries, + storeErrors, +} + +// Metrics exposes the functions required to update prometheus metrics for store protocol +type Metrics interface { + RecordQuery() + RecordError(err metricsErrCategory) +} + +type metricsImpl struct { + reg prometheus.Registerer +} + +func newMetrics(reg prometheus.Registerer) Metrics { + metricshelper.RegisterCollectors(reg, collectors...) + return &metricsImpl{ + reg: reg, + } +} + +func (m *metricsImpl) RecordQuery() { + storeQueries.Inc() +} + +type metricsErrCategory string + +var ( + dialFailure metricsErrCategory = "dial_failure" + decodeRPCFailure metricsErrCategory = "decode_rpc_failure" + writeRequestFailure metricsErrCategory = "write_request_failure" + writeResponseFailure metricsErrCategory = "write_response_failure" + storeFailure metricsErrCategory = "store_failure" + emptyRPCQueryFailure metricsErrCategory = "empty_rpc_query_failure" + peerNotFoundFailure metricsErrCategory = "peer_not_found_failure" +) + +// RecordError increases the counter for different error types +func (m *metricsImpl) RecordError(err metricsErrCategory) { + storeErrors.WithLabelValues(string(err)).Inc() +} diff --git a/waku/v2/protocol/store/utils_test.go b/waku/v2/protocol/store/utils_test.go index a803e06d..4824afec 100644 --- a/waku/v2/protocol/store/utils_test.go +++ b/waku/v2/protocol/store/utils_test.go @@ -4,6 +4,7 @@ import ( "database/sql" "testing" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/waku/persistence" "github.com/waku-org/go-waku/waku/persistence/sqlite" @@ -15,7 +16,7 @@ func MemoryDB(t *testing.T) *persistence.DBStore { db, err := sqlite.NewDB(":memory:", false, utils.Logger()) require.NoError(t, err) - dbStore, err := persistence.NewDBStore(utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) + dbStore, err := persistence.NewDBStore(prometheus.DefaultRegisterer, utils.Logger(), persistence.WithDB(db), persistence.WithMigrations(sqlite.Migrations)) require.NoError(t, err) return dbStore diff --git a/waku/v2/protocol/store/waku_resume_test.go b/waku/v2/protocol/store/waku_resume_test.go index 8f31d8c3..dea6e0e3 100644 --- a/waku/v2/protocol/store/waku_resume_test.go +++ b/waku/v2/protocol/store/waku_resume_test.go @@ -7,6 +7,7 @@ import ( "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol" @@ -24,7 +25,7 @@ func TestFindLastSeenMessage(t *testing.T) { msg4 := protocol.NewEnvelope(tests.CreateWakuMessage("4", now+4), utils.GetUnixEpoch(), "test") msg5 := protocol.NewEnvelope(tests.CreateWakuMessage("5", now+5), utils.GetUnixEpoch(), "test") - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(msg1) _ = s.storeMessage(msg3) _ = s.storeMessage(msg5) @@ -44,7 +45,7 @@ func TestResume(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) err = s1.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -66,7 +67,7 @@ func TestResume(t *testing.T) { host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -104,7 +105,7 @@ func TestResumeWithListOfPeers(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) err = s1.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -118,7 +119,7 @@ func TestResumeWithListOfPeers(t *testing.T) { host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -145,7 +146,7 @@ func TestResumeWithoutSpecifyingPeer(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) err = s1.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -159,7 +160,7 @@ func TestResumeWithoutSpecifyingPeer(t *testing.T) { host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) diff --git a/waku/v2/protocol/store/waku_store_client.go b/waku/v2/protocol/store/waku_store_client.go index 17251cbd..bd213031 100644 --- a/waku/v2/protocol/store/waku_store_client.go +++ b/waku/v2/protocol/store/waku_store_client.go @@ -11,7 +11,6 @@ import ( "go.uber.org/zap" "github.com/waku-org/go-waku/logging" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/protocol" wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/protocol/store/pb" @@ -189,7 +188,7 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec connOpt, err := store.h.NewStream(ctx, selectedPeer, StoreID_v20beta4) if err != nil { logger.Error("creating stream to peer", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "dial_failure") + store.metrics.RecordError(dialFailure) return nil, err } @@ -206,7 +205,7 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec err = writer.WriteMsg(historyRequest) if err != nil { logger.Error("writing request", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "write_request_failure") + store.metrics.RecordError(writeRequestFailure) return nil, err } @@ -214,7 +213,7 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec err = reader.ReadMsg(historyResponseRPC) if err != nil { logger.Error("reading response", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "decode_rpc_failure") + store.metrics.RecordError(decodeRPCFailure) return nil, err } @@ -278,7 +277,7 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR } if !params.localQuery && params.selectedPeer == "" { - metrics.RecordStoreError(ctx, "peer_not_found_failure") + store.metrics.RecordError(peerNotFoundFailure) return nil, ErrNoPeersAvailable } diff --git a/waku/v2/protocol/store/waku_store_common.go b/waku/v2/protocol/store/waku_store_common.go index 537bb03e..5767cd7c 100644 --- a/waku/v2/protocol/store/waku_store_common.go +++ b/waku/v2/protocol/store/waku_store_common.go @@ -7,6 +7,7 @@ import ( "github.com/libp2p/go-libp2p/core/host" libp2pProtocol "github.com/libp2p/go-libp2p/core/protocol" + "github.com/prometheus/client_golang/prometheus" "github.com/waku-org/go-waku/waku/v2/peermanager" "github.com/waku-org/go-waku/waku/v2/protocol/relay" "github.com/waku-org/go-waku/waku/v2/timesource" @@ -50,6 +51,7 @@ type WakuStore struct { ctx context.Context cancel context.CancelFunc timesource timesource.Timesource + metrics Metrics MsgC relay.Subscription wg *sync.WaitGroup @@ -65,13 +67,14 @@ type WakuStore struct { // NewWakuStore creates a WakuStore using an specific MessageProvider for storing the messages // Takes an optional peermanager if WakuStore is being created along with WakuNode. // If using libp2p host, then pass peermanager as nil -func NewWakuStore(p MessageProvider, pm *peermanager.PeerManager, timesource timesource.Timesource, log *zap.Logger) *WakuStore { +func NewWakuStore(p MessageProvider, pm *peermanager.PeerManager, timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger) *WakuStore { wakuStore := new(WakuStore) wakuStore.msgProvider = p wakuStore.wg = &sync.WaitGroup{} wakuStore.log = log.Named("store") wakuStore.timesource = timesource wakuStore.pm = pm + wakuStore.metrics = newMetrics(reg) return wakuStore } diff --git a/waku/v2/protocol/store/waku_store_persistence_test.go b/waku/v2/protocol/store/waku_store_persistence_test.go index 929e20f8..8cee8329 100644 --- a/waku/v2/protocol/store/waku_store_persistence_test.go +++ b/waku/v2/protocol/store/waku_store_persistence_test.go @@ -3,6 +3,7 @@ package store import ( "testing" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/waku/v2/protocol" "github.com/waku-org/go-waku/waku/v2/protocol/pb" @@ -14,7 +15,7 @@ import ( func TestStorePersistence(t *testing.T) { db := MemoryDB(t) - s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) defaultPubSubTopic := "test" defaultContentTopic := "1" diff --git a/waku/v2/protocol/store/waku_store_protocol.go b/waku/v2/protocol/store/waku_store_protocol.go index 8e560132..4e027bea 100644 --- a/waku/v2/protocol/store/waku_store_protocol.go +++ b/waku/v2/protocol/store/waku_store_protocol.go @@ -15,7 +15,6 @@ import ( "github.com/waku-org/go-waku/logging" "github.com/waku-org/go-waku/waku/persistence" - "github.com/waku-org/go-waku/waku/v2/metrics" "github.com/waku-org/go-waku/waku/v2/protocol" wpb "github.com/waku-org/go-waku/waku/v2/protocol/pb" "github.com/waku-org/go-waku/waku/v2/protocol/relay" @@ -149,7 +148,7 @@ func (store *WakuStore) storeMessage(env *protocol.Envelope) error { err = store.msgProvider.Put(env) if err != nil { store.log.Error("storing message", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "store_failure") + store.metrics.RecordError(storeFailure) return err } @@ -176,7 +175,7 @@ func (store *WakuStore) onRequest(s network.Stream) { err := reader.ReadMsg(historyRPCRequest) if err != nil { logger.Error("reading request", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "decode_rpc_failure") + store.metrics.RecordError(decodeRPCFailure) return } @@ -185,12 +184,12 @@ func (store *WakuStore) onRequest(s network.Stream) { logger = logger.With(logging.Filters(query.GetContentFilters())) } else { logger.Error("reading request", zap.Error(err)) - metrics.RecordStoreError(store.ctx, "empty_rpc_query_failure") + store.metrics.RecordError(emptyRPCQueryFailure) return } logger.Info("received history query") - metrics.RecordStoreQuery(store.ctx) + store.metrics.RecordQuery() historyResponseRPC := &pb.HistoryRPC{} historyResponseRPC.RequestId = historyRPCRequest.RequestId @@ -200,7 +199,7 @@ func (store *WakuStore) onRequest(s network.Stream) { err = writer.WriteMsg(historyResponseRPC) if err != nil { logger.Error("writing response", zap.Error(err), logging.PagingInfo(historyResponseRPC.Response.PagingInfo)) - metrics.RecordStoreError(store.ctx, "response_write_failure") + store.metrics.RecordError(writeResponseFailure) _ = s.Reset() } else { logger.Info("response sent") diff --git a/waku/v2/protocol/store/waku_store_protocol_test.go b/waku/v2/protocol/store/waku_store_protocol_test.go index 1b1f9175..f3490cfb 100644 --- a/waku/v2/protocol/store/waku_store_protocol_test.go +++ b/waku/v2/protocol/store/waku_store_protocol_test.go @@ -7,6 +7,7 @@ import ( "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/core/peerstore" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol" @@ -23,7 +24,7 @@ func TestWakuStoreProtocolQuery(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) topic1 := "1" @@ -42,7 +43,7 @@ func TestWakuStoreProtocolQuery(t *testing.T) { require.NoError(t, err) defer s1.Stop() - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) host2, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) s2.SetHost(host2) @@ -73,7 +74,7 @@ func TestWakuStoreProtocolLocalQuery(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) topic1 := "1" @@ -113,7 +114,7 @@ func TestWakuStoreProtocolNext(t *testing.T) { require.NoError(t, err) db := MemoryDB(t) - s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) topic1 := "1" @@ -143,7 +144,7 @@ func TestWakuStoreProtocolNext(t *testing.T) { err = host2.Peerstore().AddProtocols(host1.ID(), StoreID_v20beta4) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -188,7 +189,7 @@ func TestWakuStoreResult(t *testing.T) { require.NoError(t, err) db := MemoryDB(t) - s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(db, nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) topic1 := "1" @@ -218,7 +219,7 @@ func TestWakuStoreResult(t *testing.T) { err = host2.Peerstore().AddProtocols(host1.ID(), StoreID_v20beta4) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) @@ -278,7 +279,7 @@ func TestWakuStoreProtocolFind(t *testing.T) { host1, err := libp2p.New(libp2p.DefaultTransports, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0")) require.NoError(t, err) - s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s1 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s1.SetHost(host1) topic1 := "1" @@ -317,7 +318,7 @@ func TestWakuStoreProtocolFind(t *testing.T) { err = host2.Peerstore().AddProtocols(host1.ID(), StoreID_v20beta4) require.NoError(t, err) - s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s2 := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) s2.SetHost(host2) err = s2.Start(ctx, relay.NoopSubscription()) require.NoError(t, err) diff --git a/waku/v2/protocol/store/waku_store_query_test.go b/waku/v2/protocol/store/waku_store_query_test.go index 6be3031b..aec65d41 100644 --- a/waku/v2/protocol/store/waku_store_query_test.go +++ b/waku/v2/protocol/store/waku_store_query_test.go @@ -3,6 +3,7 @@ package store import ( "testing" + "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" "github.com/waku-org/go-waku/tests" "github.com/waku-org/go-waku/waku/v2/protocol" @@ -21,7 +22,7 @@ func TestStoreQuery(t *testing.T) { msg1 := tests.CreateWakuMessage(defaultContentTopic, utils.GetUnixEpoch()) msg2 := tests.CreateWakuMessage("2", utils.GetUnixEpoch()) - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), defaultPubSubTopic)) _ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), defaultPubSubTopic)) @@ -47,7 +48,7 @@ func TestStoreQueryMultipleContentFilters(t *testing.T) { msg2 := tests.CreateWakuMessage(topic2, utils.GetUnixEpoch()) msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch()) - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), defaultPubSubTopic)) _ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), defaultPubSubTopic)) @@ -80,7 +81,7 @@ func TestStoreQueryPubsubTopicFilter(t *testing.T) { msg2 := tests.CreateWakuMessage(topic2, utils.GetUnixEpoch()) msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch()) - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1)) _ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic2)) _ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic2)) @@ -112,7 +113,7 @@ func TestStoreQueryPubsubTopicNoMatch(t *testing.T) { msg2 := tests.CreateWakuMessage(topic2, utils.GetUnixEpoch()) msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch()) - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic2)) _ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic2)) _ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic2)) @@ -134,7 +135,7 @@ func TestStoreQueryPubsubTopicAllMessages(t *testing.T) { msg2 := tests.CreateWakuMessage(topic2, utils.GetUnixEpoch()) msg3 := tests.CreateWakuMessage(topic3, utils.GetUnixEpoch()) - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) _ = s.storeMessage(protocol.NewEnvelope(msg1, utils.GetUnixEpoch(), pubsubTopic1)) _ = s.storeMessage(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1)) _ = s.storeMessage(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1)) @@ -153,7 +154,7 @@ func TestStoreQueryForwardPagination(t *testing.T) { topic1 := "1" pubsubTopic1 := "topic1" - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) for i := 0; i < 10; i++ { msg := tests.CreateWakuMessage(topic1, utils.GetUnixEpoch()) msg.Payload = []byte{byte(i)} @@ -177,7 +178,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) { topic1 := "1" pubsubTopic1 := "topic1" - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) for i := 0; i < 10; i++ { msg := &wpb.WakuMessage{ Payload: []byte{byte(i)}, @@ -203,7 +204,7 @@ func TestStoreQueryBackwardPagination(t *testing.T) { } func TestTemporalHistoryQueries(t *testing.T) { - s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), utils.Logger()) + s := NewWakuStore(MemoryDB(t), nil, timesource.NewDefaultClock(), prometheus.DefaultRegisterer, utils.Logger()) var messages []*wpb.WakuMessage now := utils.GetUnixEpoch()