Skip to content

Commit

Permalink
fix: scraping parameters + missing EL metrics (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
taco-paco authored Apr 24, 2024
1 parent 8d20119 commit 25862b4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
39 changes: 20 additions & 19 deletions operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -154,31 +173,13 @@ 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)
return nil, err
}

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)
Expand Down
16 changes: 12 additions & 4 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 25862b4

Please sign in to comment.