added leader-slot-addresses to SlotWatcher
This commit is contained in:
parent
64332b368b
commit
db8373b81d
|
@ -35,8 +35,8 @@ type solanaCollector struct {
|
|||
rpcClient rpc.Provider
|
||||
|
||||
// config:
|
||||
slotPace time.Duration
|
||||
balanceAddresses []string
|
||||
slotPace time.Duration
|
||||
balanceAddresses []string
|
||||
leaderSlotAddresses []string
|
||||
|
||||
/// descriptors:
|
||||
|
@ -243,7 +243,7 @@ func main() {
|
|||
|
||||
collector := NewSolanaCollector(*rpcAddr, balAddresses, lsAddresses)
|
||||
|
||||
slotWatcher := SlotWatcher{client: collector.rpcClient}
|
||||
slotWatcher := NewCollectorSlotWatcher(collector)
|
||||
go slotWatcher.WatchSlots(context.Background(), collector.slotPace)
|
||||
|
||||
prometheus.MustRegister(collector)
|
||||
|
|
|
@ -18,6 +18,8 @@ const (
|
|||
type SlotWatcher struct {
|
||||
client rpc.Provider
|
||||
|
||||
leaderSlotAddresses []string
|
||||
|
||||
// currentEpoch is the current epoch we are watching
|
||||
currentEpoch int64
|
||||
// firstSlot is the first slot [inclusive] of the current epoch which we are watching
|
||||
|
@ -71,6 +73,10 @@ var (
|
|||
)
|
||||
)
|
||||
|
||||
func NewCollectorSlotWatcher(collector *solanaCollector) *SlotWatcher {
|
||||
return &SlotWatcher{client: collector.rpcClient, leaderSlotAddresses: collector.leaderSlotAddresses}
|
||||
}
|
||||
|
||||
func init() {
|
||||
prometheus.MustRegister(totalTransactionsTotal)
|
||||
prometheus.MustRegister(confirmedSlotHeight)
|
||||
|
|
|
@ -92,7 +92,7 @@ func TestSolanaCollector_WatchSlots_Static(t *testing.T) {
|
|||
leaderSlotsByEpoch.Reset()
|
||||
|
||||
collector := createSolanaCollector(&staticRPCClient{}, 100*time.Millisecond, identities, []string{})
|
||||
watcher := SlotWatcher{client: collector.rpcClient}
|
||||
watcher := NewCollectorSlotWatcher(collector)
|
||||
prometheus.NewPedanticRegistry().MustRegister(collector)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
|
Loading…
Reference in New Issue