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

Add metrics label for missing val power #113

Merged
merged 5 commits into from
Apr 7, 2023
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
2 changes: 1 addition & 1 deletion internal/consensus/metrics.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/consensus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Metrics struct {
// Number of validators who did not sign.
MissingValidators metrics.Gauge
// Total power of the missing validators.
MissingValidatorsPower metrics.Gauge
MissingValidatorsPower metrics.Gauge `metrics_labels:"validator_address"`
Copy link
Contributor Author

@BrandonWeng BrandonWeng Apr 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails right now since it's not expecting any labels

missingValidatorsPower += val.VotingPower
cs.metrics.MissingValidatorsPower.With("validator_address", val.Address.String()).Set(float64(val.VotingPower))
} else {
cs.metrics.MissingValidatorsPower.With("validator_address", val.Address.String()).Set(0)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

// Number of validators who tried to double sign.
ByzantineValidators metrics.Gauge
// Total power of the byzantine validators.
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ func TestReactorRecordsVotesAndBlockParts(t *testing.T) {
}

func TestReactorVotingPowerChange(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
ctx, cancel := context.WithTimeout(context.Background(), 2 * time.Minute)
defer cancel()

cfg := configSetup(t)
Expand Down
6 changes: 3 additions & 3 deletions internal/p2p/p2ptest/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (n *Network) Start(ctx context.Context, t *testing.T) {
case peerUpdate := <-sourceSub.Updates():
require.Equal(t, targetNode.NodeID, peerUpdate.NodeID)
require.Equal(t, p2p.PeerStatusUp, peerUpdate.Status)
case <-time.After(3 * time.Second):
case <-time.After(30 * time.Second):
require.Fail(t, "timed out waiting for peer", "%v dialing %v",
sourceNode.NodeID, targetNode.NodeID)
}
Expand All @@ -118,7 +118,7 @@ func (n *Network) Start(ctx context.Context, t *testing.T) {
NodeID: sourceNode.NodeID,
Status: p2p.PeerStatusUp,
}, peerUpdate)
case <-time.After(3 * time.Second):
case <-time.After(30 * time.Second):
require.Fail(t, "timed out waiting for peer", "%v accepting %v",
targetNode.NodeID, sourceNode.NodeID)
}
Expand Down Expand Up @@ -252,7 +252,7 @@ func (n *Network) MakeNode(ctx context.Context, t *testing.T, opts NodeOptions)
require.NoError(t, err)
require.NotNil(t, ep, "transport not listening an endpoint")

maxRetryTime := 500 * time.Millisecond
maxRetryTime := 1000 * time.Millisecond
if opts.MaxRetryTime > 0 {
maxRetryTime = opts.MaxRetryTime
}
Expand Down