@@ -26,17 +26,23 @@ import (
2626
2727
2828type networkGauges struct {
29- nodeCount prometheus.Gauge
30- minipoolCount prometheus.Gauge
31- minipoolQueue * prometheus.GaugeVec
32- networkFees * prometheus.GaugeVec
33- rplPriceBlock prometheus.Gauge
34- rplPrice prometheus.Gauge
35- networkBlock prometheus.Gauge
36- networkBalances * prometheus.GaugeVec
37- settingsFlags * prometheus.GaugeVec
38- settingsMinimumDeposit prometheus.Gauge
39- settingsMaximumDepositPoolSize prometheus.Gauge
29+ nodeCount prometheus.Gauge
30+ minipoolCount prometheus.Gauge
31+ minipoolQueue * prometheus.GaugeVec
32+ networkFees * prometheus.GaugeVec
33+ rplPriceBlock prometheus.Gauge
34+ rplPrice prometheus.Gauge
35+ networkBlock prometheus.Gauge
36+ networkBalances * prometheus.GaugeVec
37+ settingsFlags * prometheus.GaugeVec
38+ settingsMinimumDeposit prometheus.Gauge
39+ settingsMaximumDepositPoolSize prometheus.Gauge
40+ settingsInflationIntervalRate prometheus.Gauge
41+ settingsInflationIntervalBlocks prometheus.Gauge
42+ settingsInflationStartBlock prometheus.Gauge
43+ settingsMinipool * prometheus.GaugeVec
44+ settingsMinipoolLaunchTimeout prometheus.Gauge
45+ settingsMinipoolWithdrawDelay prometheus.Gauge
4046}
4147
4248
@@ -49,13 +55,15 @@ type networkMetricsProcess struct {
4955}
5056
5157
52- type networkStuff struct {
53- Block uint64
54- TotalETH * big.Int
55- StakingETH * big.Int
56- TotalRETH * big.Int
57- DepositBalance * big.Int
58- DepositExcessBalance * big.Int
58+ type networkBalances struct {
59+ Block uint64
60+ TotalETH * big.Int
61+ StakingETH * big.Int
62+ TotalRETH * big.Int
63+ DepositBalance * big.Int
64+ DepositExcessBalance * big.Int
65+ TotalRplStake * big.Int
66+ TotalEffectiveRplStake * big.Int
5967}
6068
6169
@@ -161,7 +169,7 @@ func newNetworkMetricsProcess(c *cli.Context, logger log.ColorLogger) (*networkM
161169 Namespace : "rocketpool" ,
162170 Subsystem : "settings" ,
163171 Name : "flags_bool" ,
164- Help : "settings flags on rocketpool contracts " ,
172+ Help : "settings flags on rocketpool protocol " ,
165173 },
166174 []string {"flag" },
167175 ),
@@ -177,6 +185,45 @@ func newNetworkMetricsProcess(c *cli.Context, logger log.ColorLogger) (*networkM
177185 Name : "maximum_pool_eth" ,
178186 Help : "maximum size of deposit pool" ,
179187 }),
188+ settingsInflationIntervalRate : promauto .NewGauge (prometheus.GaugeOpts {
189+ Namespace : "rocketpool" ,
190+ Subsystem : "settings" ,
191+ Name : "inflation_interval_rate" ,
192+ Help : "RPL inflation rate per interval" ,
193+ }),
194+ settingsInflationIntervalBlocks : promauto .NewGauge (prometheus.GaugeOpts {
195+ Namespace : "rocketpool" ,
196+ Subsystem : "settings" ,
197+ Name : "inflation_interval_blocks" ,
198+ Help : "RPL inflation interval in blocks" ,
199+ }),
200+ settingsInflationStartBlock : promauto .NewGauge (prometheus.GaugeOpts {
201+ Namespace : "rocketpool" ,
202+ Subsystem : "settings" ,
203+ Name : "inflation_start_block" ,
204+ Help : "RPL inflation start block" ,
205+ }),
206+ settingsMinipool : promauto .NewGaugeVec (
207+ prometheus.GaugeOpts {
208+ Namespace : "rocketpool" ,
209+ Subsystem : "settings" ,
210+ Name : "minipool_amounts" ,
211+ Help : "amount settings for rocketpool minipool" ,
212+ },
213+ []string {"category" },
214+ ),
215+ settingsMinipoolLaunchTimeout : promauto .NewGauge (prometheus.GaugeOpts {
216+ Namespace : "rocketpool" ,
217+ Subsystem : "settings" ,
218+ Name : "minipool_launch_timeout_blocks" ,
219+ Help : "Timeout period in blocks for prelaunch minipools to launch" ,
220+ }),
221+ settingsMinipoolWithdrawDelay : promauto .NewGauge (prometheus.GaugeOpts {
222+ Namespace : "rocketpool" ,
223+ Subsystem : "settings" ,
224+ Name : "minipool_withdraw_delay_blocks" ,
225+ Help : "Withdrawal delay in blocks before withdrawable minipools can be closed" ,
226+ }),
180227 }
181228
182229 p := & networkMetricsProcess {
@@ -237,22 +284,24 @@ func (p *networkMetricsProcess) updateNetwork() error {
237284 p .metrics .rplPriceBlock .Set (float64 (rplPrice .RplPriceBlock ))
238285 p .metrics .rplPrice .Set (eth .WeiToEth (rplPrice .RplPrice ))
239286
240- stuff , err := getOtherNetworkStuff (p .rp )
287+ balances , err := getNetworkBalances (p .rp )
241288 if err != nil { return err }
242289
243- p .metrics .networkBlock .Set (float64 (stuff .Block ))
244- p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalETH" }).Set (eth .WeiToEth (stuff .TotalETH ))
245- p .metrics .networkBalances .With (prometheus.Labels {"category" :"StakingETH" }).Set (eth .WeiToEth (stuff .StakingETH ))
246- p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalRETH" }).Set (eth .WeiToEth (stuff .TotalRETH ))
247- p .metrics .networkBalances .With (prometheus.Labels {"category" :"Deposit" }).Set (eth .WeiToEth (stuff .DepositBalance ))
248- p .metrics .networkBalances .With (prometheus.Labels {"category" :"DepositExcess" }).Set (eth .WeiToEth (stuff .DepositExcessBalance ))
290+ p .metrics .networkBlock .Set (float64 (balances .Block ))
291+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalETH" }).Set (eth .WeiToEth (balances .TotalETH ))
292+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"StakingETH" }).Set (eth .WeiToEth (balances .StakingETH ))
293+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalRETH" }).Set (eth .WeiToEth (balances .TotalRETH ))
294+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"Deposit" }).Set (eth .WeiToEth (balances .DepositBalance ))
295+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"DepositExcess" }).Set (eth .WeiToEth (balances .DepositExcessBalance ))
296+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalRPL" }).Set (eth .WeiToEth (balances .TotalRplStake ))
297+ p .metrics .networkBalances .With (prometheus.Labels {"category" :"TotalEffectiveRPL" }).Set (eth .WeiToEth (balances .TotalEffectiveRplStake ))
249298
250299 return nil
251300}
252301
253302
254- func getOtherNetworkStuff (rp * rocketpool.RocketPool ) (* networkStuff , error ) {
255- stuff := networkStuff {}
303+ func getNetworkBalances (rp * rocketpool.RocketPool ) (* networkBalances , error ) {
304+ stuff := networkBalances {}
256305
257306 // Sync
258307 var wg errgroup.Group
@@ -300,6 +349,20 @@ func getOtherNetworkStuff(rp *rocketpool.RocketPool) (*networkStuff, error) {
300349 }
301350 return err
302351 })
352+ wg .Go (func () error {
353+ totalRplStake , err := node .GetTotalRPLStake (rp , nil )
354+ if err == nil {
355+ stuff .TotalRplStake = totalRplStake
356+ }
357+ return err
358+ })
359+ wg .Go (func () error {
360+ totalEffectiveRplStake , err := node .GetTotalEffectiveRPLStake (rp , nil )
361+ if err == nil {
362+ stuff .TotalEffectiveRplStake = totalEffectiveRplStake
363+ }
364+ return err
365+ })
303366
304367 // Wait for data
305368 if err := wg .Wait (); err != nil {
@@ -354,6 +417,11 @@ func (p *networkMetricsProcess) updateSettings() error {
354417 var wg errgroup.Group
355418 var depositEnabled , assignDepositEnabled , minipoolWithdrawEnabled , submitBalancesEnabled , processWithdrawalEnabled , nodeRegistrationEnabled , nodeDepositEnabled bool
356419 var minimumDeposit , maximumDepositPoolSize * big.Int
420+ var inflationIntervalRate float64
421+ var inflationIntervalBlocks , inflationStartBlock uint64
422+ var minipoolLaunchBalance , minipoolFullDepositNodeAmount , minipoolHalfDepositNodeAmount , minipoolEmptyDepositNodeAmount * big.Int
423+ var minipoolFullDepositUserAmount , minipoolHalfDepositUserAmount , minipoolEmptyDepositUserAmount * big.Int
424+ var minipoolLaunchTimeout , minipoolWithdrawalDelay uint64
357425
358426 // Get data
359427 wg .Go (func () error {
@@ -419,7 +487,90 @@ func (p *networkMetricsProcess) updateSettings() error {
419487 }
420488 return err
421489 })
422-
490+ wg .Go (func () error {
491+ response , err := protocol .GetInflationIntervalRate (p .rp , nil )
492+ if err == nil {
493+ inflationIntervalRate = response
494+ }
495+ return err
496+ })
497+ wg .Go (func () error {
498+ response , err := protocol .GetInflationIntervalBlocks (p .rp , nil )
499+ if err == nil {
500+ inflationIntervalBlocks = response
501+ }
502+ return err
503+ })
504+ wg .Go (func () error {
505+ response , err := protocol .GetInflationStartBlock (p .rp , nil )
506+ if err == nil {
507+ inflationStartBlock = response
508+ }
509+ return err
510+ })
511+ wg .Go (func () error {
512+ response , err := protocol .GetMinipoolLaunchBalance (p .rp , nil )
513+ if err == nil {
514+ minipoolLaunchBalance = response
515+ }
516+ return err
517+ })
518+ wg .Go (func () error {
519+ response , err := protocol .GetMinipoolFullDepositNodeAmount (p .rp , nil )
520+ if err == nil {
521+ minipoolFullDepositNodeAmount = response
522+ }
523+ return err
524+ })
525+ wg .Go (func () error {
526+ response , err := protocol .GetMinipoolHalfDepositNodeAmount (p .rp , nil )
527+ if err == nil {
528+ minipoolHalfDepositNodeAmount = response
529+ }
530+ return err
531+ })
532+ wg .Go (func () error {
533+ response , err := protocol .GetMinipoolEmptyDepositNodeAmount (p .rp , nil )
534+ if err == nil {
535+ minipoolEmptyDepositNodeAmount = response
536+ }
537+ return err
538+ })
539+ wg .Go (func () error {
540+ response , err := protocol .GetMinipoolFullDepositUserAmount (p .rp , nil )
541+ if err == nil {
542+ minipoolFullDepositUserAmount = response
543+ }
544+ return err
545+ })
546+ wg .Go (func () error {
547+ response , err := protocol .GetMinipoolHalfDepositUserAmount (p .rp , nil )
548+ if err == nil {
549+ minipoolHalfDepositUserAmount = response
550+ }
551+ return err
552+ })
553+ wg .Go (func () error {
554+ response , err := protocol .GetMinipoolEmptyDepositUserAmount (p .rp , nil )
555+ if err == nil {
556+ minipoolEmptyDepositUserAmount = response
557+ }
558+ return err
559+ })
560+ wg .Go (func () error {
561+ response , err := protocol .GetMinipoolLaunchTimeout (p .rp , nil )
562+ if err == nil {
563+ minipoolLaunchTimeout = response
564+ }
565+ return err
566+ })
567+ wg .Go (func () error {
568+ response , err := protocol .GetMinipoolWithdrawalDelay (p .rp , nil )
569+ if err == nil {
570+ minipoolWithdrawalDelay = response
571+ }
572+ return err
573+ })
423574
424575 // Wait for data
425576 if err := wg .Wait (); err != nil {
@@ -434,6 +585,18 @@ func (p *networkMetricsProcess) updateSettings() error {
434585 p .metrics .settingsFlags .With (prometheus.Labels {"flag" :"NodeDepositEnabled" }).Set (float64 (B2i (nodeDepositEnabled )))
435586 p .metrics .settingsMinimumDeposit .Set (eth .WeiToEth (minimumDeposit ))
436587 p .metrics .settingsMaximumDepositPoolSize .Set (eth .WeiToEth (maximumDepositPoolSize ))
588+ p .metrics .settingsInflationIntervalRate .Set (inflationIntervalRate )
589+ p .metrics .settingsInflationIntervalBlocks .Set (float64 (inflationIntervalBlocks ))
590+ p .metrics .settingsInflationStartBlock .Set (float64 (inflationStartBlock ))
591+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"LaunchBalance" }).Set (eth .WeiToEth (minipoolLaunchBalance ))
592+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"FullDepositNodeAmount" }).Set (eth .WeiToEth (minipoolFullDepositNodeAmount ))
593+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"HalfDepositNodeAmount" }).Set (eth .WeiToEth (minipoolHalfDepositNodeAmount ))
594+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"EmptyDepositNodeAmount" }).Set (eth .WeiToEth (minipoolEmptyDepositNodeAmount ))
595+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"FullDepositUserAmount" }).Set (eth .WeiToEth (minipoolFullDepositUserAmount ))
596+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"HalfDepositUserAmount" }).Set (eth .WeiToEth (minipoolHalfDepositUserAmount ))
597+ p .metrics .settingsMinipool .With (prometheus.Labels {"category" :"EmptyDepositUserAmount" }).Set (eth .WeiToEth (minipoolEmptyDepositUserAmount ))
598+ p .metrics .settingsMinipoolLaunchTimeout .Set (float64 (minipoolLaunchTimeout ))
599+ p .metrics .settingsMinipoolWithdrawDelay .Set (float64 (minipoolWithdrawalDelay ))
437600
438601 return nil
439602}
0 commit comments