From c9f2bd5ab0e02fb199bedfc49ff656ab721bb774 Mon Sep 17 00:00:00 2001 From: Matt Johnstone Date: Tue, 29 Oct 2024 13:34:26 +0200 Subject: [PATCH] removed solana_active_validators metric --- cmd/solana_exporter/exporter.go | 15 --------------- cmd/solana_exporter/exporter_test.go | 3 --- 2 files changed, 18 deletions(-) diff --git a/cmd/solana_exporter/exporter.go b/cmd/solana_exporter/exporter.go index ae32b34..da6268a 100644 --- a/cmd/solana_exporter/exporter.go +++ b/cmd/solana_exporter/exporter.go @@ -14,7 +14,6 @@ import ( const ( SkipStatusLabel = "status" - StateLabel = "state" NodekeyLabel = "nodekey" VotekeyLabel = "votekey" VersionLabel = "version" @@ -39,7 +38,6 @@ type SolanaCollector struct { config *ExporterConfig /// descriptors: - ValidatorActive *GaugeDesc ValidatorActiveStake *GaugeDesc ValidatorLastVote *GaugeDesc ValidatorRootSlot *GaugeDesc @@ -61,14 +59,6 @@ func NewSolanaCollector(provider rpc.Provider, config *ExporterConfig) *SolanaCo rpcClient: provider, logger: slog.Get(), config: config, - ValidatorActive: NewGaugeDesc( - "solana_validator_active", - fmt.Sprintf( - "Total number of active validators, grouped by %s ('%s' or '%s')", - StateLabel, StateCurrent, StateDelinquent, - ), - StateLabel, - ), ValidatorActiveStake: NewGaugeDesc( "solana_validator_active_stake", fmt.Sprintf("Active stake per validator (represented by %s and %s)", VotekeyLabel, NodekeyLabel), @@ -120,7 +110,6 @@ func NewSolanaCollector(provider rpc.Provider, config *ExporterConfig) *SolanaCo } func (c *SolanaCollector) Describe(ch chan<- *prometheus.Desc) { - ch <- c.ValidatorActive.Desc ch <- c.NodeVersion.Desc ch <- c.ValidatorActiveStake.Desc ch <- c.ValidatorLastVote.Desc @@ -142,7 +131,6 @@ func (c *SolanaCollector) collectVoteAccounts(ctx context.Context, ch chan<- pro voteAccounts, err := c.rpcClient.GetVoteAccounts(ctx, rpc.CommitmentConfirmed, nil) if err != nil { c.logger.Errorf("failed to get vote accounts: %v", err) - ch <- c.ValidatorActive.NewInvalidMetric(err) ch <- c.ValidatorActiveStake.NewInvalidMetric(err) ch <- c.ValidatorLastVote.NewInvalidMetric(err) ch <- c.ValidatorRootSlot.NewInvalidMetric(err) @@ -150,9 +138,6 @@ func (c *SolanaCollector) collectVoteAccounts(ctx context.Context, ch chan<- pro return } - ch <- c.ValidatorActive.MustNewConstMetric(float64(len(voteAccounts.Delinquent)), StateDelinquent) - ch <- c.ValidatorActive.MustNewConstMetric(float64(len(voteAccounts.Current)), StateCurrent) - for _, account := range append(voteAccounts.Current, voteAccounts.Delinquent...) { accounts := []string{account.VotePubkey, account.NodePubkey} ch <- c.ValidatorActiveStake.MustNewConstMetric(float64(account.ActivatedStake), accounts...) diff --git a/cmd/solana_exporter/exporter_test.go b/cmd/solana_exporter/exporter_test.go index 59a201e..ddb9b57 100644 --- a/cmd/solana_exporter/exporter_test.go +++ b/cmd/solana_exporter/exporter_test.go @@ -468,7 +468,6 @@ func TestSolanaCollector_Collect_Static(t *testing.T) { prometheus.NewPedanticRegistry().MustRegister(collector) testCases := []collectionTest{ - collector.ValidatorActive.makeCollectionTest(NewLV(2, "current"), NewLV(1, "delinquent")), collector.ValidatorActiveStake.makeCollectionTest(abcValues(49, 42, 43)...), collector.ValidatorLastVote.makeCollectionTest(abcValues(92, 147, 148)...), collector.ValidatorRootSlot.makeCollectionTest(abcValues(3, 18, 19)...), @@ -489,7 +488,6 @@ func TestSolanaCollector_Collect_Dynamic(t *testing.T) { // start off by testing initial state: testCases := []collectionTest{ - collector.ValidatorActive.makeCollectionTest(NewLV(3, "current"), NewLV(0, "delinquent")), collector.ValidatorActiveStake.makeCollectionTest(abcValues(1_000_000, 1_000_000, 1_000_000)...), collector.ValidatorRootSlot.makeCollectionTest(abcValues(0, 0, 0)...), collector.ValidatorDelinquent.makeCollectionTest(abcValues(0, 0, 0)...), @@ -509,7 +507,6 @@ func TestSolanaCollector_Collect_Dynamic(t *testing.T) { // now test the final state testCases = []collectionTest{ - collector.ValidatorActive.makeCollectionTest(NewLV(2, "current"), NewLV(1, "delinquent")), collector.ValidatorActiveStake.makeCollectionTest(abcValues(2_000_000, 500_000, 1_000_000)...), collector.ValidatorRootSlot.makeCollectionTest(abcValues(0, 0, 0)...), collector.ValidatorDelinquent.makeCollectionTest(abcValues(0, 0, 1)...),