Skip to content

Add vote bubbling metrics #2138

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

Merged
merged 1 commit into from
Oct 4, 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
52 changes: 43 additions & 9 deletions snow/engine/snowman/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ import (
)

type metrics struct {
bootstrapFinished, numRequests, numBlocked, numBlockers, numNonVerifieds prometheus.Gauge
numBuilt, numBuildsFailed, numUselessPutBytes, numUselessPushQueryBytes prometheus.Counter
getAncestorsBlks metric.Averager
bootstrapFinished prometheus.Gauge
numRequests prometheus.Gauge
numBlocked prometheus.Gauge
numBlockers prometheus.Gauge
numNonVerifieds prometheus.Gauge
numBuilt prometheus.Counter
numBuildsFailed prometheus.Counter
numUselessPutBytes prometheus.Counter
numUselessPushQueryBytes prometheus.Counter
numProcessingAncestorFetchesFailed prometheus.Counter
numProcessingAncestorFetchesDropped prometheus.Counter
numProcessingAncestorFetchesSucceeded prometheus.Counter
numProcessingAncestorFetchesUnneeded prometheus.Counter
getAncestorsBlks metric.Averager
}

// Initialize the metrics
func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error {
errs := wrappers.Errs{}
m.bootstrapFinished = prometheus.NewGauge(prometheus.GaugeOpts{
Expand All @@ -39,6 +49,11 @@ func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error
Name: "blockers",
Help: "Number of blocks that are blocking other blocks from being issued because they haven't been issued",
})
m.numNonVerifieds = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "non_verified_blks",
Help: "Number of non-verified blocks in the memory",
})
m.numBuilt = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "blks_built",
Expand All @@ -59,18 +74,33 @@ func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error
Name: "num_useless_push_query_bytes",
Help: "Amount of useless bytes received in PushQuery messages",
})
m.numProcessingAncestorFetchesFailed = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_processing_ancestor_fetches_failed",
Help: "Number of votes that were dropped due to unknown blocks",
})
m.numProcessingAncestorFetchesDropped = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_processing_ancestor_fetches_dropped",
Help: "Number of votes that were dropped due to decided blocks",
})
m.numProcessingAncestorFetchesSucceeded = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_processing_ancestor_fetches_succeeded",
Help: "Number of votes that were applied to ancestor blocks",
})
m.numProcessingAncestorFetchesUnneeded = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_processing_ancestor_fetches_unneeded",
Help: "Number of votes that were directly applied to blocks",
})
m.getAncestorsBlks = metric.NewAveragerWithErrs(
namespace,
"get_ancestors_blks",
"blocks fetched in a call to GetAncestors",
reg,
&errs,
)
m.numNonVerifieds = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "non_verified_blks",
Help: "Number of non-verified blocks in the memory",
})

errs.Add(
reg.Register(m.bootstrapFinished),
Expand All @@ -82,6 +112,10 @@ func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error
reg.Register(m.numBuildsFailed),
reg.Register(m.numUselessPutBytes),
reg.Register(m.numUselessPushQueryBytes),
reg.Register(m.numProcessingAncestorFetchesFailed),
reg.Register(m.numProcessingAncestorFetchesDropped),
reg.Register(m.numProcessingAncestorFetchesSucceeded),
reg.Register(m.numProcessingAncestorFetchesUnneeded),
)
return errs.Err
}
7 changes: 7 additions & 0 deletions snow/engine/snowman/voter.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (v *voter) getProcessingAncestor(ctx context.Context, initialVote ids.ID) (
zap.Stringer("bubbledVoteID", bubbledVote),
zap.Error(err),
)
v.t.numProcessingAncestorFetchesFailed.Inc()
return ids.Empty, false
}

Expand All @@ -124,6 +125,7 @@ func (v *voter) getProcessingAncestor(ctx context.Context, initialVote ids.ID) (
zap.Stringer("status", blk.Status()),
zap.Uint64("height", blk.Height()),
)
v.t.numProcessingAncestorFetchesDropped.Inc()
return ids.Empty, false
}

Expand All @@ -133,6 +135,11 @@ func (v *voter) getProcessingAncestor(ctx context.Context, initialVote ids.ID) (
zap.Stringer("bubbledVoteID", bubbledVote),
zap.Uint64("height", blk.Height()),
)
if bubbledVote != initialVote {
v.t.numProcessingAncestorFetchesSucceeded.Inc()
} else {
v.t.numProcessingAncestorFetchesUnneeded.Inc()
}
return bubbledVote, true
}

Expand Down