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 bls pool metric #12133

Merged
merged 5 commits into from
Mar 15, 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: 2 additions & 0 deletions beacon-chain/operations/blstoexec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ go_library(
"//consensus-types/primitives:go_default_library",
"//container/doubly-linked-list:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)
Expand Down
14 changes: 14 additions & 0 deletions beacon-chain/operations/blstoexec/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"math"
"sync"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/blocks"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
"github.com/prysmaticlabs/prysm/v3/config/params"
Expand All @@ -18,6 +20,13 @@ import (
// we only do it when the map is smaller than this upper bound.
const blsChangesPoolThreshold = 2000

var (
blsToExecMessageInPoolTotal = promauto.NewGauge(prometheus.GaugeOpts{
Name: "bls_to_exec_message_pool_total",
Help: "The number of saved bls to exec message in the operation cool.",
})
)

// PoolManager maintains pending and seen BLS-to-execution-change objects.
// This pool is used by proposers to insert BLS-to-execution-change objects into new blocks.
type PoolManager interface {
Expand Down Expand Up @@ -116,6 +125,9 @@ func (p *Pool) InsertBLSToExecChange(change *ethpb.SignedBLSToExecutionChange) {

p.pending.Append(doublylinkedlist.NewNode(change))
p.m[change.Message.ValidatorIndex] = p.pending.Last()

blsToExecMessageInPoolTotal.Inc()

}

// MarkIncluded is used when an object has been included in a beacon block. Every block seen by this
Expand All @@ -134,6 +146,8 @@ func (p *Pool) MarkIncluded(change *ethpb.SignedBLSToExecutionChange) {
if p.numPending() == blsChangesPoolThreshold {
p.cycleMap()
}

blsToExecMessageInPoolTotal.Dec()
}

// ValidatorExists checks if the bls to execution change object exists
Expand Down