From 2d6da21d865aaee52af1e8d1c92b45822e8f6fa4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:24:41 +0000 Subject: [PATCH 1/5] Bump github.com/aws/aws-sdk-go-v2/service/kms from 1.35.4 to 1.35.5 Bumps [github.com/aws/aws-sdk-go-v2/service/kms](https://github.com/aws/aws-sdk-go-v2) from 1.35.4 to 1.35.5. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/kms/v1.35.4...service/ecs/v1.35.5) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/kms dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ada0fe8b..ec5f27e7 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/ava-labs/teleporter v1.0.5 github.com/aws/aws-sdk-go-v2 v1.30.4 github.com/aws/aws-sdk-go-v2/config v1.27.9 - github.com/aws/aws-sdk-go-v2/service/kms v1.35.4 + github.com/aws/aws-sdk-go-v2/service/kms v1.35.5 github.com/ethereum/go-ethereum v1.13.8 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/onsi/ginkgo/v2 v2.20.1 diff --git a/go.sum b/go.sum index 8a094cb7..a04f2759 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibR github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU= -github.com/aws/aws-sdk-go-v2/service/kms v1.35.4 h1:mG1MH6yPwT5gNEeBrhig3FHc4mK0QaZOXsmQUbphP6Y= -github.com/aws/aws-sdk-go-v2/service/kms v1.35.4/go.mod h1:A5CS0VRmxxj2YKYLCY08l/Zzbd01m6JZn0WzxgT1OCA= +github.com/aws/aws-sdk-go-v2/service/kms v1.35.5 h1:XUomV7SiclZl1QuXORdGcfFqHxEHET7rmNGtxTfNB+M= +github.com/aws/aws-sdk-go-v2/service/kms v1.35.5/go.mod h1:A5CS0VRmxxj2YKYLCY08l/Zzbd01m6JZn0WzxgT1OCA= github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8= github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM= From 41db31c2db1c2d0666acb83e19c6acbd72ae540a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:35:18 +0000 Subject: [PATCH 2/5] Bump github.com/prometheus/client_golang from 1.20.1 to 1.20.2 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.1 to 1.20.2. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.20.1...v1.20.2) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ec5f27e7..25f1cfd7 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/onsi/gomega v1.34.1 github.com/pingcap/errors v0.11.4 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.20.1 + github.com/prometheus/client_golang v1.20.2 github.com/redis/go-redis/v9 v9.6.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 diff --git a/go.sum b/go.sum index a04f2759..4617833a 100644 --- a/go.sum +++ b/go.sum @@ -518,8 +518,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= -github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= From 90683455fe887281cba8c8678c327bc16f7ddecc Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Mon, 26 Aug 2024 17:29:10 -0400 Subject: [PATCH 3/5] don't set constants.PrimaryNetworkID as a trackedsubnet --- relayer/main/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/relayer/main/main.go b/relayer/main/main.go index 5340bba2..358561c7 100644 --- a/relayer/main/main.go +++ b/relayer/main/main.go @@ -143,6 +143,9 @@ func main() { // TODO: remove this from here once trackedSubnets are no longer referenced // by ping messages in avalanchego for _, sourceBlockchain := range cfg.SourceBlockchains { + if sourceBlockchain.GetSubnetID() == constants.PrimaryNetworkID { + continue + } trackedSubnets.Add(sourceBlockchain.GetSubnetID()) } From 7935089b437d18eeddef25d3accf1cbc566a210d Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Tue, 27 Aug 2024 07:41:27 -0400 Subject: [PATCH 4/5] add metrics for connect/disconnect events --- peers/app_request_network.go | 2 +- ...rics.go => app_request_network_metrics.go} | 26 +++++++++++++++++++ peers/external_handler.go | 5 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) rename peers/{app_request_netrwork_metrics.go => app_request_network_metrics.go} (67%) diff --git a/peers/app_request_network.go b/peers/app_request_network.go index 512a32a8..c36a02b5 100644 --- a/peers/app_request_network.go +++ b/peers/app_request_network.go @@ -61,7 +61,7 @@ func NewNetwork( } // Create the handler for handling inbound app responses - handler, err := NewRelayerExternalHandler(logger, prometheus.DefaultRegisterer) + handler, err := NewRelayerExternalHandler(logger, metrics, prometheus.DefaultRegisterer) if err != nil { logger.Error( "Failed to create p2p network handler", diff --git a/peers/app_request_netrwork_metrics.go b/peers/app_request_network_metrics.go similarity index 67% rename from peers/app_request_netrwork_metrics.go rename to peers/app_request_network_metrics.go index 12c5ea6b..b585533e 100644 --- a/peers/app_request_netrwork_metrics.go +++ b/peers/app_request_network_metrics.go @@ -13,6 +13,8 @@ var ( type AppRequestNetworkMetrics struct { infoAPICallLatencyMS prometheus.Histogram pChainAPICallLatencyMS prometheus.Histogram + connects prometheus.Counter + disconnects prometheus.Counter } func newAppRequestNetworkMetrics(registerer prometheus.Registerer) (*AppRequestNetworkMetrics, error) { @@ -40,8 +42,32 @@ func newAppRequestNetworkMetrics(registerer prometheus.Registerer) (*AppRequestN } registerer.MustRegister(pChainAPICallLatencyMS) + connects := prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "connects", + Help: "Number of connected events", + }, + ) + if connects == nil { + return nil, ErrFailedToCreateAppRequestNetworkMetrics + } + registerer.MustRegister(connects) + + disconnects := prometheus.NewCounter( + prometheus.CounterOpts{ + Name: "disconnects", + Help: "Number of disconnected events", + }, + ) + if disconnects == nil { + return nil, ErrFailedToCreateAppRequestNetworkMetrics + } + registerer.MustRegister(disconnects) + return &AppRequestNetworkMetrics{ infoAPICallLatencyMS: infoAPICallLatencyMS, pChainAPICallLatencyMS: pChainAPICallLatencyMS, + connects: connects, + disconnects: disconnects, }, nil } diff --git a/peers/external_handler.go b/peers/external_handler.go index d34d352a..5e9689af 100644 --- a/peers/external_handler.go +++ b/peers/external_handler.go @@ -30,6 +30,7 @@ type RelayerExternalHandler struct { responseChans map[uint32]chan message.InboundMessage responsesCount map[uint32]expectedResponses timeoutManager timer.AdaptiveTimeoutManager + metrics *AppRequestNetworkMetrics } // expectedResponses counts the number of responses and compares against the expected number of responses @@ -41,6 +42,7 @@ type expectedResponses struct { // Teleporter application relayer, as well as handle timeouts. func NewRelayerExternalHandler( logger logging.Logger, + metrics *AppRequestNetworkMetrics, registerer prometheus.Registerer, ) (*RelayerExternalHandler, error) { // TODO: Leaving this static for now, but we may want to have this as a config option @@ -69,6 +71,7 @@ func NewRelayerExternalHandler( responseChans: make(map[uint32]chan message.InboundMessage), responsesCount: make(map[uint32]expectedResponses), timeoutManager: timeoutManager, + metrics: metrics, }, nil } @@ -102,6 +105,7 @@ func (h *RelayerExternalHandler) Connected(nodeID ids.NodeID, version *version.A zap.Stringer("version", version), zap.Stringer("subnetID", subnetID), ) + h.metrics.connects.Inc() } func (h *RelayerExternalHandler) Disconnected(nodeID ids.NodeID) { @@ -109,6 +113,7 @@ func (h *RelayerExternalHandler) Disconnected(nodeID ids.NodeID) { "Disconnected", zap.Stringer("nodeID", nodeID), ) + h.metrics.disconnects.Inc() } // RegisterRequestID registers an AppRequest by requestID, and marks the number of From e047507aef1396b48719d1e047436dc082105482 Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Tue, 27 Aug 2024 10:26:33 -0400 Subject: [PATCH 5/5] don't pass in defaultRegisterer from the app_request_network --- peers/app_request_network.go | 2 +- peers/external_handler.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/peers/app_request_network.go b/peers/app_request_network.go index c36a02b5..c6d9d4af 100644 --- a/peers/app_request_network.go +++ b/peers/app_request_network.go @@ -61,7 +61,7 @@ func NewNetwork( } // Create the handler for handling inbound app responses - handler, err := NewRelayerExternalHandler(logger, metrics, prometheus.DefaultRegisterer) + handler, err := NewRelayerExternalHandler(logger, metrics) if err != nil { logger.Error( "Failed to create p2p network handler", diff --git a/peers/external_handler.go b/peers/external_handler.go index 5e9689af..7b6417ce 100644 --- a/peers/external_handler.go +++ b/peers/external_handler.go @@ -43,7 +43,6 @@ type expectedResponses struct { func NewRelayerExternalHandler( logger logging.Logger, metrics *AppRequestNetworkMetrics, - registerer prometheus.Registerer, ) (*RelayerExternalHandler, error) { // TODO: Leaving this static for now, but we may want to have this as a config option cfg := timer.AdaptiveTimeoutConfig{ @@ -54,7 +53,7 @@ func NewRelayerExternalHandler( TimeoutHalflife: constants.DefaultNetworkTimeoutHalflife, } - timeoutManager, err := timer.NewAdaptiveTimeoutManager(&cfg, registerer) + timeoutManager, err := timer.NewAdaptiveTimeoutManager(&cfg, prometheus.DefaultRegisterer) if err != nil { logger.Error( "Failed to create timeout manager",