Skip to content

Commit

Permalink
pkg/solana: expand HealthReport (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Jan 17, 2025
1 parent fb6416c commit 81a855e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/solana/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,12 @@ func (v *verifiedCachedClient) GetAccountInfoWithOpts(ctx context.Context, addr
}

func newChain(id string, cfg *config.TOMLConfig, ks core.Keystore, lggr logger.Logger, ds sqlutil.DataSource) (*chain, error) {
lggr = logger.Named(lggr, "Chain")
lggr = logger.With(lggr, "chainID", id, "chain", "solana")
var ch = chain{
id: id,
cfg: cfg,
lggr: logger.Named(lggr, "Chain"),
lggr: lggr,
clientCache: map[string]*verifiedCachedClient{},
}

Expand Down Expand Up @@ -531,6 +532,11 @@ func (c *chain) Ready() error {
func (c *chain) HealthReport() map[string]error {
report := map[string]error{c.Name(): c.Healthy()}
services.CopyHealth(report, c.txm.HealthReport())
services.CopyHealth(report, c.balanceMonitor.HealthReport())
if c.cfg.MultiNode.Enabled() {
report[c.multiNode.Name()] = c.multiNode.Healthy()
report[c.txSender.Name()] = c.txSender.Healthy()
}
return report
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/solana/client/multinode/multi_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func NewMultiNode[
return c
}

func (c *MultiNode[CHAIN_ID, RPC]) Name() string {
return c.lggr.Name()
}

func (c *MultiNode[CHAIN_ID, RPC]) ChainID() CHAIN_ID {
return c.chainID
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/solana/client/multinode/transaction_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ type TransactionSender[TX any, RESULT SendTxResult, CHAIN_ID ID, RPC SendTxRPCCl
chStop services.StopChan
}

func (txSender *TransactionSender[TX, RESULT, CHAIN_ID, RPC]) Name() string {
return txSender.lggr.Name()
}

// SendTransaction - broadcasts transaction to all the send-only and primary nodes in MultiNode.
// A returned nil or error does not guarantee that the transaction will or won't be included. Additional checks must be
// performed to determine the final state.
Expand Down

0 comments on commit 81a855e

Please sign in to comment.