From 1718154bd7bcb9273eaacdc5849f1523843d94d8 Mon Sep 17 00:00:00 2001 From: Yacov Manevich Date: Wed, 23 Oct 2024 17:42:56 +0200 Subject: [PATCH] Move RPC metrics registration after its client's initialization It makes no sense to have a metrics collector that uses RPC invocations to be registered before its RPC client has been initialized. Changed the order of initialization accordingly. Signed-off-by: Yacov Manevich --- vms/rpcchainvm/vm_client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vms/rpcchainvm/vm_client.go b/vms/rpcchainvm/vm_client.go index c5a358df8edd..05add90700dc 100644 --- a/vms/rpcchainvm/vm_client.go +++ b/vms/rpcchainvm/vm_client.go @@ -156,10 +156,6 @@ func (vm *VMClient) Initialize( return err } - if err := chainCtx.Metrics.Register("", vm); err != nil { - return err - } - // Initialize the database dbServerListener, err := grpcutils.NewListener() if err != nil { @@ -229,6 +225,10 @@ func (vm *VMClient) Initialize( return err } + if err := chainCtx.Metrics.Register("", vm); err != nil { + return err + } + id, err := ids.ToID(resp.LastAcceptedId) if err != nil { return err