Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed solana_active_validators metric #67

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions cmd/solana_exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

const (
SkipStatusLabel = "status"
StateLabel = "state"
NodekeyLabel = "nodekey"
VotekeyLabel = "votekey"
VersionLabel = "version"
Expand All @@ -39,7 +38,6 @@ type SolanaCollector struct {
config *ExporterConfig

/// descriptors:
ValidatorActive *GaugeDesc
ValidatorActiveStake *GaugeDesc
ValidatorLastVote *GaugeDesc
ValidatorRootSlot *GaugeDesc
Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -142,17 +131,13 @@ 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)
ch <- c.ValidatorDelinquent.NewInvalidMetric(err)
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...)
Expand Down
3 changes: 0 additions & 3 deletions cmd/solana_exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)...),
Expand All @@ -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)...),
Expand All @@ -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)...),
Expand Down
Loading