From 25862b4834dd3c63f0328eb74ed94ab9c68235b5 Mon Sep 17 00:00:00 2001 From: edwin <102215563+taco-paco@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:33:29 +0700 Subject: [PATCH] fix: scraping parameters + missing EL metrics (#125) --- operator/operator.go | 39 ++++++++++++++++++++------------------- prometheus/prometheus.yml | 16 ++++++++++++---- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/operator/operator.go b/operator/operator.go index 14d44271..e28dba4e 100644 --- a/operator/operator.go +++ b/operator/operator.go @@ -131,7 +131,26 @@ func NewOperatorFromConfig(c optypes.NodeConfig) (*Operator, error) { logger.Warnf("OPERATOR_ECDSA_KEY_PASSWORD env var not set. using empty string") } - reg := prometheus.NewRegistry() + ecdsaPrivateKey, err := sdkecdsa.ReadKey(c.EcdsaPrivateKeyStorePath, ecdsaKeyPassword) + if err != nil { + logger.Error("Failed to read ecdsa private key", "err", err) + return nil, err + } + + chainioConfig := clients.BuildAllConfig{ + EthHttpUrl: c.EthRpcUrl, + EthWsUrl: c.EthWsUrl, + RegistryCoordinatorAddr: c.AVSRegistryCoordinatorAddress, + OperatorStateRetrieverAddr: c.OperatorStateRetrieverAddress, + AvsName: AVS_NAME, + PromMetricsIpPortAddress: c.EigenMetricsIpPortAddress, + } + sdkClients, err := clients.BuildAll(chainioConfig, ecdsaPrivateKey, logger) + if err != nil { + panic(err) + } + reg := sdkClients.PrometheusRegistry + ethRpcClient, ethWsClient, err := createEthClients(&c, reg, logger) if err != nil { return nil, err @@ -154,12 +173,6 @@ func NewOperatorFromConfig(c optypes.NodeConfig) (*Operator, error) { panic(err) } - ecdsaPrivateKey, err := sdkecdsa.ReadKey(c.EcdsaPrivateKeyStorePath, ecdsaKeyPassword) - if err != nil { - logger.Error("Failed to read ecdsa private key", "err", err) - return nil, err - } - txSender, err := wallet.NewPrivateKeyWallet(ethRpcClient, signerV2, common.HexToAddress(c.OperatorAddress), logger) if err != nil { logger.Error("Failed to create transaction sender", "err", err) @@ -167,18 +180,6 @@ func NewOperatorFromConfig(c optypes.NodeConfig) (*Operator, error) { } txMgr := txmgr.NewSimpleTxManager(txSender, ethRpcClient, logger, signerV2, common.HexToAddress(c.OperatorAddress)) - chainioConfig := clients.BuildAllConfig{ - EthHttpUrl: c.EthRpcUrl, - EthWsUrl: c.EthWsUrl, - RegistryCoordinatorAddr: c.AVSRegistryCoordinatorAddress, - OperatorStateRetrieverAddr: c.OperatorStateRetrieverAddress, - AvsName: AVS_NAME, - PromMetricsIpPortAddress: c.EigenMetricsIpPortAddress, - } - sdkClients, err := clients.BuildAll(chainioConfig, ecdsaPrivateKey, logger) - if err != nil { - panic(err) - } avsAndEigenMetrics := metrics.NewAvsAndEigenMetrics(AVS_NAME, sdkClients.Metrics, reg) aggregatorRpcClient, err := NewAggregatorRpcClient(c.AggregatorServerIpPortAddress, logger, avsAndEigenMetrics) diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 7383f605..f2082454 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -8,20 +8,28 @@ global: # A scrape configuration containing exactly one endpoint to scrape. scrape_configs: - - job_name: "prometheus" scrape_interval: 10s static_configs: - targets: ["localhost:9090"] - - job_name: "sffl-node" + - job_name: "sffl-operator0" + scrape_interval: 5s + static_configs: + - targets: ["near-sffl-operator0:9090"] + labels: + role: "operator" + instance: "0" + + - job_name: "sffl-operator1" scrape_interval: 5s static_configs: # host.docker.internal might not work on linux # TODO: do https://stackoverflow.com/a/67158212/4971151 # - targets: ["host.docker.internal:9090"] - - targets: ["sffl-operator1:9090"] + - targets: ["near-sffl-operator1:9091"] labels: - bot: "sffl-node" + role: "operator" + instance: "1" relabel_configs: # is this actually useful? We already have the job name \ No newline at end of file